-
Notifications
You must be signed in to change notification settings - Fork 220
Description
This is a Bug Report
Description
There are 2 issues after plugin version 1.4.0
-
use of ${self:} throws error
ServerlessError: Trying to populate non string value into a string for variable ${self:}. Please make sure the value of the property is a string
using ${self} works -
serverless plugin (version 2.29.0) does the variables.populateService on start which runs the scripts from serverless.yml
link: https://github.com/serverless/serverless/blob/f5b2b9be395c9c2d3de4c4f91f991276bc22dc33/lib/Serverless.js#L296
also the serverless-step-functions plugin (version 2.30.0) tries to populate the variables before setting up step functions
link:
| .then(serverlessFileParam => this.serverless.variables.populateObject(serverlessFileParam) |
because of this scripts are running twice, which is not expected.
this is a link to a PR after which these issues are coming
#116
sharing a sample example to reproduce the issue
service: test-step-function
provider:
name: aws
onStart: ${file(./on_start.js):onStart}
frameworkVersion: '2'
stepFunctions:
stateMachines:
hellostepfunc1:
definition:
StartAt: HelloWorld1
States:
HelloWorld1:
Type: Task
Next: ToSqsQueue
Resource: "arn:aws:lambda:#{AWS::Region}:#{AWS::AccountId}:function:hello-world"
End: true
ToSqsQueue:
Type: Task
Resource: arn:aws:states:::sqs:sendMessage
Parameters:
QueueUrl: https://sqs.#{AWS::Region}.amazonaws.com/#{AWS::AccountId}/hello-world-queue
MessageBody.$: "$"
MessageGroupId: "1"
End: true
plugins:
- serverless-step-functions
custom:
servicename: ${self:} # first issue, ${self:} doesn't work after version 1.4.0, works for ${self}, error is ServerlessError: Trying to populate non string value into a string for variable ${self:}. Please make sure the value of the property is a string
add_resources: ${file(./resources.js)}
export:
statics:
- service: ${self:custom.servicename}
Additional Data
sample project to reproduce the issues:
step_functions_example.zip