Repository navigation
feat(aws-node-step-functions): add a Step Functions example with a live test - #843
Merged
Merged
Conversation
… and mark the trimmed output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
aws-node-step-functions: a Standard AWS Step Functions state machine deployed with the community pluginserverless-step-functions(pinned to 3.31.2), with a live test.What it teaches
One lesson: define a state machine under
stepFunctionsinserverless.yml, deploy it with the Framework, and run it with the plugin'sserverless invoke stepfcommand. The workflow is the same shape asaws-node-durable-function(a step, a 10-second wait, a result), so the two can be compared like with like:ValidateOrder(Task, Lambda) →IsValid(Choice) →WaitTenSeconds(Wait) →ProcessOrder(Task, Lambda, withRetry)Rejected(Pass), for an order without anorderIdorder-workflow-${sls:stage};id: OrderWorkflowkeeps the stack outputOrderWorkflowArnthe same on every stageNode.js 24,
arm64, ES modules, no runtime dependencies; the plugin is the only (development) dependency.Left out on purpose: Express workflows,
Catchand failure states, events that start an execution (HTTP, schedule, EventBridge), state machine logging and X-Ray, service integrations other than Lambda, callbacks (.waitForTaskToken), alarms and notifications. Each is a separate lesson; the README's Next steps link the plugin's README and the Amazon States Language reference for them.Check
test/smoke.mjsruns what the README's Try it runs,serverless invoke stepf --name orderWorkflow, twice:orderId: the execution must beSUCCEEDEDwith outputstatus: "processed", the sameorderId, andcompletedAtat least 9 s afteracceptedAt(the Wait state);{}: the execution must beSUCCEEDEDwith outputstatus: "rejected"(the Choice's default branch).Test plan
us-east-1, Framework 4.47.0.PASS aws-node-step-functions 4.47.0 189s(stageexoty53qj3g). Check line:execution …:order-workflow-exoty53qj3g:…: SUCCEEDED, order smoke-6itgxz5t processed 10.379 s after it was accepted; execution …: SUCCEEDED, order without orderId rejected.status: "shipped"):FAIL scratch-neg/sfn-neg 4.47.0 216sat thecheckstep,expected output status "shipped"; got {"orderId":"smoke-hbrmq0v7","status":"processed",…}.npm ci,serverless deploy, bothinvoke stepfcommands,aws stepfunctions get-execution-history,serverless info --verbose,serverless remove); every output in the README comes from these runs.SUCCEEDED,processedafter the 10-second wait, and{"status":"rejected","orderId":null}), listed the same 16 history events ending inExecutionSucceeded, removed the example and confirmed the stack was gone.npm audit(dev dependencies included): 0 vulnerabilities.npm test(323 pass),npm run validate,npm run check-docs,node scripts/check-examples.mjs aws-node-step-functions --package: clean.Generated by Claude Code