Skip to content

Step Functions locally evaluate HTTP invoke as invalid ARN

0

I'm trying to run Step Functions locally with the Docker Image amazon/aws-stepfunctions-local:latest and following definition

{
    "Comment": "Step Functions Example",
    "StartAt": "HelloWorld",
    "States": {
        "HelloWorld": {
            "Type": "Task",
            "Resource": "arn:aws:states:::http:invoke",
            "Parameters": {
                "ApiEndpoint": "http://localhost:9000",
                "Method": "GET",
                "Authentication": {
                    "ConnectionArn": "arn:aws:states:eu-central-1:123456789012:connection"
                },
                "Headers": {
                    "content-type": "application/json"
                }
            },
            "End": true
        }
    }
}

but it doesn't end with successful response from HTTP request as it should but with following error inside Docker container:

{
   "Type": "ExecutionFailed",
   "PreviousEventId": 2,
   "ExecutionFailedEventDetails": {
      "Error": "States.Runtime",
      "Cause": "An error occurred while scheduling the state 'HelloWorld'. The provided ARN 'arn:aws:states:eu-central-1:123456789012:http:invoke' is invalid."
   }
}

I was following the official docs but without any success.

What am I doing wrong? Thanks for any help!

asked 2 years ago255 views

2 Answers
0

The latest version of Step Functions Local does not support HTTP Tasks at this time. You can consider using LocalStack for an alternative local emulator for Step Functions.

https://github.com/localstack/localstack

AWS

answered 2 years ago

-1

The issue you're encountering is related to running AWS Step Functions locally and trying to use the HTTP invoke feature. When running Step Functions locally, not all features available in the cloud version are fully supported or implemented in the local version.

The error message you're seeing suggests that the local Step Functions environment is not recognizing the ARN for the HTTP invoke task. This is likely because the local version doesn't fully support or implement the HTTP invoke functionality that's available in the cloud version of Step Functions.

When running Step Functions locally, it's primarily designed for basic testing and development of workflow logic. Some advanced features, like HTTP invoke, may not work as expected in the local environment.

To work around this issue, you have a few options:

  1. Use a Lambda function as a proxy: Instead of directly using the HTTP invoke task, you could create a Lambda function that makes the HTTP request. Then, in your Step Functions definition, invoke this Lambda function instead.

  2. Use the AWS CLI or SDK to test your state machine: If you need to test the full functionality including the HTTP invoke, you may need to deploy your state machine to the AWS cloud environment.

  3. Mock the HTTP response: For local testing purposes, you could replace the HTTP invoke task with a Pass state that simulates the expected response from your HTTP endpoint.

Remember, the local version of Step Functions is primarily for basic testing and may not support all features available in the cloud version. For full feature testing, especially with integrations like HTTP invoke, you may need to use the actual AWS Step Functions service in the cloud.

If you need to test the HTTP invoke functionality specifically, you might consider using the TestState API in the cloud environment, which allows you to test individual states without creating or updating an entire state machine.
Sources
Running Step Functions Local on Your Computer - AWS Step Functions
TestState - AWS Step Functions
External endpoints and testing of task states now available in AWS Step Functions | AWS News Blog

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.