Reputation: 33
I've got step-functions-local and serverless-offline configured to test a state machine (let's call it #1) that triggers another state machine (#2) defined within the project.
Both show as created when I fire up the local server with sls offline start --stage dev
:
[Serverless Step Functions Local] 2022-07-29 11:03:59.867: [200] CreateStateMachine <=
{"sdkResponseMetadata":null,"sdkHttpMetadata":null,"stateMachineArn":"arn:aws:states:us-east-1:123:stateMachine:Foo",
"creationDate":1659117839863}
[Serverless Step Functions Local] 2022-07-29 11:03:59.883: [200] CreateStateMachine <=
{"sdkResponseMetadata":null,"sdkHttpMetadata":null,"stateMachineArn":
"arn:aws:states:us-east-1:123:stateMachine:Bar","creationDate":1659117839882}
I then test #1 with the following command:
aws stepfunctions --endpoint http://localhost:8083 start-execution --state-machine \
arn:aws:states:us-east-1:123:stateMachine:Foo --name local-test-$RANDOM --input <JSON string payload>
#1 executes several steps successfully, including read/write S3 operations, until it reaches the step to trigger #2; at that point, it fails with an exception that reads in part:
"Error":"StepFunctions- StateMachineDoesNotExistException",
"Cause":"State Machine Does Not Exist: 'arn:aws:states:us-east-1:123:stateMachine:Bar'
(Service: AWSStepFunctions; Status Code: 400; Error Code: StateMachineDoesNotExist
Here's how the step to start state machine #1 is defined in the #1 .yml file:
BarStateMachine:
Type: Task
Resource: "arn:aws:states:::states:startExecution.sync:2"
Parameters:
StateMachineArn:
arn:aws:states:us-east-1:123:stateMachine:Bar
I can get #1 to work if, instead of pointing to the arn for the locally-created #2, I point it to the arn of the deployed version. However, this deployed version is of course a remote resource, which sort of defeats the purpose of local testing. Any ideas on how to get the local version of #2 executed properly?
Upvotes: 0
Views: 1247
Reputation: 1
Try something like export STEP_FUNCTIONS_ENDPOINT=http://localhost:8083 && serverless offline start
- that should cause step function local to use itself for the step function service integration.
Upvotes: 0