Invoking Step Function from Api Gateway

Hey there!

I’ve been trying to set up Localstack so that I can invoke an API Gateway which then triggers a step functions, I have everything created, however when I call the API Endpoint with curl i get the following:

{"Type": "User", "message": "Error invoking integration for API Gateway ID '5zpknu8ld7': Expecting value: line 1 column 1 (char 0)", "__type": "InvalidRequest"}

This is how i’m creating the integration:

awslocal apigateway put-integration \
    --rest-api-id $gateway_id \
    --resource-id $session_resource_id \
    --http-method GET \
    --type AWS \
    --integration-http-method POST \
    --uri arn:aws:apigateway:us-east-1:states:action/StartExecution \
    --request-parameters '{ "input": "{}", "name": "MyExecution", "stateMachineArn": "'"$STEP_FUNCTION_ARN"'" }' \
    --passthrough-behavior WHEN_NO_MATCH

Does anyone have any ideas why this is happening?

Hi @thomas.turner we have a working example using terraform https://github.com/localstack/localstack-terraform-samples/blob/master/apigateway-step-functions-integration/main.tf. Not sure if you are familiar with TF but this could help to see what might be the issue. Otherwise I can try reproduce yours and give you a more concrete answer

Hi @anon92451107 thank you so much for your response, I will attempt to set up using terraform using your example and get back to you

1 Like

@anon92451107 Hey, i managed to get my setup working using terraform so thank you!

1 Like