GithubHelp home page GithubHelp logo

christophebougere / stepfunctions-local Goto Github PK

View Code? Open in Web Editor NEW
127.0 127.0 17.0 483 KB

Execute AWS Step Functions locally

License: Apache License 2.0

JavaScript 99.92% Dockerfile 0.08%
aws nodejs stepfunctions stepfunctions-local

stepfunctions-local's People

Contributors

brikis98 avatar christophebougere avatar fossabot avatar hervenivon avatar lanwen avatar mjm461 avatar pianomansam avatar tristanbenier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

stepfunctions-local's Issues

Step Function execution logs

Hi,
Is there a way to obtain the detailed execution logs/stack trace for a step function?
I am asking because my step function execution is failing and when i use the describe-execution cli command i only see the json containing the execution status (RUNNING, SUCCEEDED, FAILED,etc.). I wanted to see the logs to determine the reason for this failure.
Thanks in advance!

Testing with localstack returns unexpected results.

I followed the steps in this documentation: https://github.com/airware/stepfunctions-local/wiki/Lambdas-deployed-on-Localstack.

1 execution should pass, 3 should fail. However, all 4 fail. I've even created the default AWS Hello World step function template and it also fails. The --debug option with aws cli isn't showing any errors in the output, so I'm not why the status is always "failed" even for single step functions of type Pass.

I did hook up to my AWS and test the Hello World step function and the AWS CLI reported Success.

Let me know if you need anymore info. I think it should be rather easy to reproduce since it involves following the steps in the wiki link above.

BadRequest instead of StateMachineAlreadyExists

When creating 2 times the same step function, the JS SDK fails with a Bad Request while the StateMachineAlreadyExists error is well catched in the server. The response format must differ a little bit, and the SDK isn't able to parse it. This could potentially be the same issue for many other errors.

Input not passed to Lambda functions

Love the idea behind this project and have been trying to incorporate it into one of my apps that uses step functions so I can test 100% locally. I've been able to:

  1. Create step function state machines locally.
  2. Execute the state machine, passing some JSON as input.
  3. When the state machine hits a Task with a Lambda function, I've been able to use --lambda-endpoint option to have it call a mock lambda server I'm running locally.

The gotcha is that my mock lambda server gets the POST... But the body contains an empty JSON input: {}. For some reason, the original JSON input I passed in is dropped. Any ideas what I'm doing wrong?

Run template step function and mock resource

Hi, this tool can help me doing this local test:
I want to test the step function logic, I have the template yml/json, can I use stepfuntions-local to execute that template locally?
And then replace the resource arn with local lambdas running? (the local lambda will only return some json info to test the InputPath and ResultPath of the step function logic).

just hangs

@ChristopheBougere The following command just hangs, I am running it on localstack and tested some hello world functions on lambda. All is OK, but this command just hangs:

stepfunctions-local start --lambda-endpoint http://localhost:4574 --lambda-region local

...
I have no idea what is going on?

Are the new Task types (e.g., ECS, SNS, etc) supported?

I've been using this project heavily for local testing with step functions and it has been working great ๐Ÿบ

A few months ago, AWS added support for executing a variety of AWS services from Step Functions, including ECS, SNS, etc. I tried the following to run an ECS Task:

    "example-ecs-task": {
      "Resource": "arn:aws:states:::ecs:runTask.sync",
      "Type": "Task",
      "Parameters": {
        "Cluster": "my-ecs-cluster",
        "LaunchType": "FARGATE",
        "TaskDefinition": "example-ecs-task"
      },
      "Next": "some-other-state"
    }

When I try to run the state machine, I get the error:

Error while retrieving task type of resource: arn:aws:states:::ecs:runTask.sync

Is this not yet supported?

Problem getting the description in local state machine.

When the machine is executed in local with SUCCEEDED status.

Trying to get the description throw AWS API:
val describeExecutionRequest = new DescribeExecutionRequest().withExecutionArn("" +
"arn:aws:states:local:012826867935:execution:Machine_Test16022018:edb6b75e-9e29-4e8f-80a6-bb502e01f0c3")
val describeExecution: DescribeExecutionResult = client.describeExecution(describeExecutionRequest)

Throws exception below:
Exception in thread "main" com.amazonaws.SdkClientException: Unable to unmarshall response (We expected a VALUE token but got: START_OBJECT)

It works correctly with the state machine running on AWS.

can't succesfully run a statemachine with local lambdas

Hi,

I'm unable to execute a single 'hello world' python lambda with localstack and stepfunctions-local.
The lambda is working as expected:
aws --endpoint-url=http://localhost:4574 lambda invoke --function-name lambda1 outfile.txt && cat outfile.txt { "StatusCode": 200 } Hello from Lambda

Then created a statemachine that uses the ARN of 'lambda1':
aws stepfunctions --endpoint http://localhost:4584 create-state-machine --role-arn arn:aws:iam::000000000000:role/service-role/MyRole --name successmachine --definition '{"Comment": "Test Step Function","StartAt": "SuccessLambda","States": {"SuccessLambda": {"Type": "Task","Resource": "arn:aws:lambda:us-east-1:000000000000:function:lambda1","Next": "EndState"},"EndState": {"Type": "Pass","End": true}}}'

But after starting an execution and grabbing the details of the execution-arn:

aws stepfunctions --endpoint http://localhost:4584 get-execution-history --execution-arn arn:aws:states:local:000000000000:execution:successmachine:14410b5c-ff6b-4a6c-a1a6-88c06a1fc39c { "events": [ { "timestamp": 1526997500.206, "executionStartedEventDetails": { "input": {} }, "type": "ExecutionStarted", "id": 1, "previousEventId": 0 }, { "timestamp": 1526997500.208, "type": "TaskStateEntered", "id": 2, "stateEnteredEventDetails": { "input": {}, "name": "SuccessLambda" }, "previousEventId": 1 }, { "timestamp": 1526997500.208, "lambdaFunctionScheduledEventDetails": { "input": {}, "timeoutInSeconds": 99999999 }, "type": "LambdaFunctionScheduled", "id": 3, "previousEventId": 2 }, { "timestamp": 1526997500.209, "type": "LambdaFunctionStarted", "id": 4, "previousEventId": 3 }, { "lambdaFunctionFailedEventDetails": { "cause": "SyntaxError", "error": "Unexpected token H in JSON at position 0" }, "timestamp": 1526997500.247, "type": "LambdaFunctionFailed", "id": 5, "previousEventId": 4 }, { "executionFailedEventDetails": { "cause": "SyntaxError", "error": "Unexpected token H in JSON at position 0" }, "timestamp": 1526997500.248, "type": "ExecutionFailed", "id": 6, "previousEventId": 5 } ] }

I'm not getting the clue of the JSON error. Any help is appreciated!

InputPath and OutputPath assumes object, overwrites value with {} if not

There is nothing in the API spec that requires the state to be an object. In fact, I have several state machines in production that pass around non-object states.

This issue can be reproduced by creating a state machine like this:

{"Comment":"Test Step Function","StartAt":"Pass","States":{"Pass":{"Type":"Pass","OutputPath":"$.pass","Next":"Pass2"},"Pass2":{"Type":"Pass","End":true}}}

Then run the state machine with this input: {"pass": 5}

Here's my output:

stepfunctions-local:log   executions: [
  stepfunctions-local:log     {
  stepfunctions-local:log       name: '2c5244a2-3abb-4dc7-ba2c-34f60d270aa6',
  stepfunctions-local:log       input: { pass: 5 },
  stepfunctions-local:log       executionArn: 'arn:aws:states:local:0123456789:execution:TestString:2c5244a2-3abb-4dc7-ba2c-34f60d270aa6',
  stepfunctions-local:log       startDate: 1562358255.26,
  stepfunctions-local:log       stateMachineArn: 'arn:aws:states:us-east-1:0123456789:stateMachine:TestString',
  stepfunctions-local:log       status: 'SUCCEEDED',
  stepfunctions-local:log       events: [
  stepfunctions-local:log         {
  stepfunctions-local:log           id: 1,
  stepfunctions-local:log           previousEventId: 0,
  stepfunctions-local:log           timestamp: 1562358255.263,
  stepfunctions-local:log           type: 'ExecutionStarted',
  stepfunctions-local:log           executionStartedEventDetails: { input: '{"pass":5}' }
  stepfunctions-local:log         },
  stepfunctions-local:log         {
  stepfunctions-local:log           id: 2,
  stepfunctions-local:log           previousEventId: 1,
  stepfunctions-local:log           timestamp: 1562358255.265,
  stepfunctions-local:log           type: 'PassStateEntered',
  stepfunctions-local:log           stateEnteredEventDetails: { input: '{"pass":5}', name: 'Pass' }
  stepfunctions-local:log         },
  stepfunctions-local:log         {
  stepfunctions-local:log           id: 3,
  stepfunctions-local:log           previousEventId: 2,
  stepfunctions-local:log           timestamp: 1562358255.267,
  stepfunctions-local:log           type: 'PassStateExited',
  stepfunctions-local:log           stateExitedEventDetails: { name: 'Pass', output: '5' }
  stepfunctions-local:log         },
  stepfunctions-local:log         {
  stepfunctions-local:log           id: 4,
  stepfunctions-local:log           previousEventId: 3,
  stepfunctions-local:log           timestamp: 1562358255.269,
  stepfunctions-local:log           type: 'PassStateEntered',
  stepfunctions-local:log           stateEnteredEventDetails: { input: '{}', name: 'Pass2' }
  stepfunctions-local:log         },
  stepfunctions-local:log         {
  stepfunctions-local:log           id: 5,
  stepfunctions-local:log           previousEventId: 4,
  stepfunctions-local:log           timestamp: 1562358255.27,
  stepfunctions-local:log           type: 'PassStateExited',
  stepfunctions-local:log           stateExitedEventDetails: { name: 'Pass2', output: '{}' }
  stepfunctions-local:log         },
  stepfunctions-local:log         {
  stepfunctions-local:log           id: 6,
  stepfunctions-local:log           previousEventId: 5,
  stepfunctions-local:log           timestamp: 1562358255.271,
  stepfunctions-local:log           type: 'ExecutionSucceeded',
  stepfunctions-local:log           executionSucceededEventDetails: { output: '{}' }
  stepfunctions-local:log         }
  stepfunctions-local:log       ],
  stepfunctions-local:log       stopDate: 1562358255.273,
  stepfunctions-local:log       output: {}
  stepfunctions-local:log     }
  stepfunctions-local:log   ],

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.