Serverless 3.x support?
Hi,
the requirements state that this plugin requires Serverless >= v2.32.0.
I have Serverless 3.21.0:
Environment: darwin, node 18.6.0, framework 3.21.0 (local), plugin 6.2.2, SDK 4.3.2
When I try to install serverless-step-functions-local package, the installation fails:
$ ./node_modules/serverless/bin/serverless.js plugin install -n serverless-step-functions-local
✖ npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: [email protected]
npm ERR! node_modules/serverless
npm ERR! serverless@"^3.18.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer serverless@"^2.32.0" from [email protected]
npm ERR! node_modules/serverless-step-functions-local
npm ERR! dev serverless-step-functions-local@"0.4.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
Is this by design, the plugin does not indeed support Serverless 3.x?
The peer dependency is ^2.32.0, which means any version >= 2.32.0 and < 3.0.0.
I haven't tested it with the most recent version of Serverless. If it does work, happy to accept a PR updating the peer dependency. :)
I've tried this plugin with [email protected] and [email protected], and found out that OFFLINE_STEP_FUNCTIONS_ARN_ environment variables do not appear.
As a workaround, directly defining arn:aws:states:${region}:${accountId}:stateMachine:${stateMachineName} in lambda codes seems working.
@shinnoki I tried the solution you recommended and it starts the execution but after the first lambda function, it goes into a wait state, and then after some time it gives a timeout error. Did you face this issue also?
I'm running into the same issue. Manually setting the OFFLINE_STEP_FUNCTIONS_ARN_ env variables doesn't seem to work. I get this error:
StateMachineDoesNotExist: State Machine Does Not Exist
Also not seeing any logs from serverless-step-functions-local on startup (as we did before upgrading serverless). It seems like maybe serverless-step-functions-local is not starting at all.
serverless: 3.24.1
serverless-offline: 11.2.3
serverless-step-functions: 3.11.0
serverless-step-functions-local: 0.4.0
In case it helps someone find this in search, we were initially getting this error before realizing the OFFLINE_STEP_FUNCTIONS_ARN_ env variables aren't being set:
InvalidArn: Invalid Arn: ''
EDIT
I ended up getting this to work. There are a few issues:
- It doesn't look like env variables can be set directly in the way that this plugin is setting them (directly setting
process.env.WHATEVER). It produces this serverless configuration warning:
Warning: Invalid configuration encountered at 'provider.environment': unrecognized property 'OFFLINE_STEP_FUNCTIONS_ARN_dripEmailScheduling-development'
It might be possible to tell serverless to allow those env variables. But for now manually setting them is a fine workaround.
- I needed to include
startwhen starting serverless (e.g.sls offline start ...). Apparently that is required or the serverless-offline lifecycle events won't fire (c.f. https://www.serverless.com/plugins/serverless-offline). This is what ultimately fixed the issue.
Does it invoke local lambda functions as well in steps? @cullylarson
I have tried out the PR #21 and I my state machine also gets stuck in the wait state until it times out
@cullylarson was your solution to just to use sls offline start?
Does it invoke local lambda functions as well in steps? @cullylarson
You can invoke it with the aws cli aws stepfunctions --endpoint-url http://localhost:8083 start-execution --state-machine-arn ARN