skip to Main Content

I have an API Gateway that makes POST to Step Function, than SF goes to Dynamo
I want to send the result of it back from SF to API.

Does it possible?

I tried to pause before the end of the SF and found out that a response to API went back faster that SF ended. Looks like I need to use some async/sync Action name for it (currently it is StartExecution)

2

Answers


  1. It seems there seems to be no direct way to return the result, one thing you can possibly do is use lambda function to handle the API Post request and inside the lambda function you can call the step function. After the execution return the results.

    If you’re using python, then you can use this method in the lambda to wait

    waiter = stepfunctions_client.get_waiter("execution_succeeded") 
    waiter.wait(executionArn=execution_arn)
    

    Refer the documentation for more info(for python),
    https://boto3.amazonaws.com/v1/documentation/api/1.9.42/reference/services/stepfunctions.html#SFN.Client.get_waiter

    Login or Signup to reply.
  2. Use StartSyncExecution for the action name.
    Tutorial.
    Doc for Step Functions.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search