Description
This is a Feature Proposal
Description
What should be solved
Ability to execute a state machine locally. This would be really helpful to ease development.
I'd like to open discussion on allowing resources creation using AWS StepFunctions API on a specific endpoint when an option is passed.
How can we achieve it
Using stepfunctions-local, anyone can start a local stepfunctions server which is AWS-API compliant (goal being to be as close as possible from the AWS engine, like with serverless-dynamodb-local and serverless-s3-local which are using local server with the same API).
Then we could either add an --offline
/--local
option to serverless invoke
:
sls invoke stepf --name <stepfunctionname> --data '{"foo":"bar"}' --offline
or create a new subcommand invoke local
(which would look like the official serverless invoke local
for lambda):
sls invoke local stepf --name <stepfunctionname> --data '{"foo":"bar"}'
Instead of deploying resources to CloudFormation, this command would parse the stepfunction definition in serverless.yml
and create resources using AWS StepFunctions API on the defined endpoint (like http://localhost:4584
).
Basically, we don't need IAM roles and we would have to:
- Create the state machine
- Create the potential activities
- Start an execution
- Wait until the execution is finished and display the output or the error. => [To be discussed] it could also simply return the
executionArn
Additional config
- Stepfunctions server endpoint (hostname + port) and region
Similar or dependent PR:
- State machine definition validation using asl-validator #90 was only adding the validation, which may not be necessary anymore with a way to execute state machines locally
Let me know your opinion on this, I would be happy to submit a PR if you're interested in this feature.