serverless-step-functions
serverless-step-functions copied to clipboard
Latest version of plugin throws error with latest version of serverless framework
Bug Report
Getting the following error:
Invalid variable reference syntax for variable . You can only reference env vars, options, & files. You can check our docs for more info.

This happens with the latest npm install --save-dev serverless-step-functions -> [email protected]
version: [email protected] does not have this issue.
serverless --version
Framework Core: 2.28.3
Plugin: 4.4.3
SDK: 2.3.2
Components: 3.7.1
Description
In very simple terms, this is my serverless.yml:
service: test-step-function
frameworkVersion: '2'
provider:
name: aws
runtime: python3.8
lambdaHashingVersion: 20201221
plugins:
- serverless-step-functions
functions:
hello:
handler: handler.hello
If the plugin section is commented out, the deployment goes through without a hitch. The absence of a stepFunction section is not a problem, nor it is needed. Simply including the plugin reference should not cause this to crash.
Same issue here !!
But it's very strange as it was working before and suddenly stopped working and returning the same mentioned error
Same issue here.
Same issue
UPD: Updating serverless to 2.28.6 solved problem for me. Try sls upgrade
after upgrading, i am getting the following error:
EDIT: just to clarify, i am using ${opt:stage} heavily throughout my project. it seems that if the line to import the serverless-step-functions plugin is present while using 2.28.6, i get this
EDIT2: after downgrading to [email protected], i can deploy once again
Type Error ---------------------------------------------
TypeError: Cannot read property 'stage' of undefined at Variables.getValueFromOptions (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:639:26) at Variables.getValueFromSource (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:579:17) at Variables.splitAndGet (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:448:17) at matches.map (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:387:40) at Array.map (
) at Variables.populateMatches (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:387:20) at Variables.populateValue (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:418:30) at properties.filter.map (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:300:38) at Array.map ( ) at Variables.populateVariables (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:299:8) at Variables.populateObjectImpl (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:333:30) at initialCall (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:329:40) at Variables.initialCall (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:112:20) at Variables.populateObject (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:329:17) at parse.then.serverlessFileParam (/home/frank/Documents/PPS/PAS/Serverless/pas-serverless-gateway/public/node_modules/serverless-step-functions/lib/yamlParser.js:26:62)
serverless.yml
#[email protected] frameworkVersion: '2' service: test-project
provider: name: aws runtime: nodejs12.x timeout: 15 region: us-east-1 tracing: true
custom: test: ${opt:stage}-test
plugins:
- serverless-step-functions
The update of 2.28.6 also solved this bug for me
Not working with serverless 2.28.7, downgrade 2.28.0 fixed the issue
after upgrading, i am getting the following error:
EDIT: just to clarify, i am using ${opt:stage} heavily throughout my project. it seems that if the line to import the serverless-step-functions plugin is present while using 2.28.6, i get this
EDIT2: after downgrading to [email protected], i can deploy once again
Type Error --------------------------------------------- TypeError: Cannot read property 'stage' of undefined at Variables.getValueFromOptions (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:639:26) at Variables.getValueFromSource (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:579:17) at Variables.splitAndGet (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:448:17) at matches.map (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:387:40) at Array.map () at Variables.populateMatches (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:387:20) at Variables.populateValue (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:418:30) at properties.filter.map (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:300:38) at Array.map () at Variables.populateVariables (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:299:8) at Variables.populateObjectImpl (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:333:30) at initialCall (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:329:40) at Variables.initialCall (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:112:20) at Variables.populateObject (/usr/local/lib/node_modules/serverless/lib/classes/Variables.js:329:17) at parse.then.serverlessFileParam (/home/frank/Documents/PPS/PAS/Serverless/pas-serverless-gateway/public/node_modules/serverless-step-functions/lib/yamlParser.js:26:62)
serverless.yml
#[email protected] frameworkVersion: '2' service: test-project provider: name: aws runtime: nodejs12.x timeout: 15 region: us-east-1 tracing: true custom: test: ${opt:stage}-test plugins:
- serverless-step-functions
Same error here
Seeing a similar issue. It seems simply updating to these versions and including the plugin (with or without a stepFunctions section in the config) will generate an error
"serverless": "^2.39.0",
"serverless-step-functions": "^2.30.0",
Serverless Error ----------------------------------------
Trying to populate non string value into a string for variable ${sls:stage}. Please make sure the value of the property is a string.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: linux
Node Version: 14.16.1
Framework Version: 2.39.0 (local)
Plugin Version: 4.5.3
SDK Version: 4.2.2
Components Version: 3.9.1
Same problem as @razor-x above when referencing the serverless-step-functions plugin.
The same as well.
This seems to be fixed in v3.0.0
Same error in 3.19.0
this.serverless.variables.populateObject is not a function at /Users/xxxx/yyyy/zzzz/node_modules/serverless-step-functions/lib/yamlParser.js:26:62
Its still the same in v3.
Will this be addressed? Am I missing something or can't we use step functions with v3 rn? Thanks for clarifying.
I was able to resolve this by updating the serverless-step-functions to v3.12.1