breathbath / aws-stepfunctions-visualisation

My React project to visualise stepfunctions executions in the go based simulator under git@github.com:chiradeep/stepfn-local.git
1 stars 1 forks source link

complex state machine crashes the gui #1

Closed chiradeep closed 5 years ago

chiradeep commented 5 years ago
aws stepfunctions --endpoint http://localhost:4584 create-state-machine --name sample-state-machine55 --definition '{  "Comment": "Stepfn-local test state machine",  "StartAt": "Step1",  "States": {    "Step1": {      "Comment": "First Step",      "Parameters": {        "payload.$": "$.payload",        "step_name": "Step1",        "step_list.$": "$.step_list",        "parent_step.$": "$.parent_step"      },      "Type": "Task",      "Resource": "https://us-central1-step-test-234405.cloudfunctions.net/step-test",      "TimeoutSeconds": 10,      "Catch": [{        "ErrorEquals": ["ErrStepErr"],        "ResultPath": "$.error",        "Next": "Step7"      }],      "Next": "Step2"    },    "Step2": {      "Comment": "Second Step",      "Type": "Task",      "Parameters": {        "payload.$": "$.payload",        "step_name": "Step2",        "step_list.$": "$.step_list",        "parent_step.$": "$.parent_step"      },      "Resource": "https://us-central1-step-test-234405.cloudfunctions.net/step-test",      "TimeoutSeconds": 10,      "Catch": [{        "ErrorEquals": ["ErrStep2"],        "ResultPath": "$.error",        "Next": "Step6"      }],      "Next": "Step3"    },    "Step3": {      "Comment": "Third Step",      "Type": "Task",      "Parameters": {        "payload.$": "$.payload",        "step_name": "Step3",        "step_list.$": "$.step_list",        "parent_step.$": "$.parent_step"      },      "Resource": "https://us-central1-step-test-234405.cloudfunctions.net/step-test",      "TimeoutSeconds": 10,      "Catch": [{        "ErrorEquals": ["ErrStep3"],        "ResultPath": "$.error",        "Next": "Step5"      }],      "Next": "Step4"    },    "Step4": {      "Type": "Task",      "Parameters": {        "payload.$": "$.payload",        "step_name": "Step4",        "step_list.$": "$.step_list",        "parent_step.$": "$.parent_step"      },      "Resource": "https://us-central1-step-test-234405.cloudfunctions.net/step-test",      "Next":"Step7"    },    "Step5": {      "Comment": "Fifth Step",      "Type": "Task",      "Parameters": {        "payload.$": "$.payload",        "step_name": "Step4",        "step_list.$": "$.step_list",        "parent_step.$": "$.parent_step"      },      "Resource": "https://us-central1-step-test-234405.cloudfunctions.net/step-test",      "TimeoutSeconds": 10,      "Retry": [{        "ErrorEquals": ["States.ALL"],        "IntervalSeconds": 1,        "MaxAttempts": 2,        "BackoffRate": 2.0        }],        "Catch": [{          "ErrorEquals": ["ErrStep5"],          "ResultPath": "$.error",          "Next": "Step5Failed"        }      ],      "Next": "Step6"    },    "Step5Failed": {      "Type": "Fail",      "Error": "ReleaseFailedError"    },    "Step6": {      "Comment": "Sixth step",      "Type": "Task",      "Parameters": {        "payload.$": "$.payload",        "step_name": "Step6",        "step_list.$": "$.step_list",        "parent_step.$": "$.parent_step"      },      "Resource": "https://us-central1-step-test-234405.cloudfunctions.net/step-test",      "TimeoutSeconds": 10,      "Retry": [{        "ErrorEquals": ["States.TaskFailed"],        "IntervalSeconds": 1,        "MaxAttempts": 2,        "BackoffRate": 2.0        }],        "Catch": [{          "ErrorEquals": ["ErrStep6"],          "ResultPath": "$.error",          "Next": "Step6Failed"        }      ],      "Next": "Step7"    },    "Step6Failed": {      "Type": "Fail",      "Error": "Step6FailedError"    },    "Step7": {      "Type": "Parallel",      "Next": "Step8",      "Branches": [        {        "StartAt": "Step7a",         "States": {           "Step7a": {             "Type": "Task",             "Parameters": {              "payload.$": "$.payload",              "step_name": "Step7a",              "step_list.$": "$.step_list",              "parent_step.$": "$.parent_step"            },             "Resource": "https://us-central1-step-test-234405.cloudfunctions.net/step-test",             "Next": "Wait5Secs"           },           "Wait5Secs": {             "Type": "Wait",             "Seconds": 1,             "End": true           }         }       },       {         "StartAt": "Step7b",         "States": {           "Step7b": {             "Type": "Task",             "Parameters": {              "payload.$": "$.payload",              "step_name": "Step7b",              "step_list.$": "$.step_list",              "parent_step.$": "$.parent_step"            },             "Resource": "https://us-central1-step-test-234405.cloudfunctions.net/step-test",             "Next": "Wait10Secs"           },           "Wait10Secs": {             "Type": "Wait",             "Seconds": 1,             "End": true           }         }       }      ]    },    "Step8": {      "Comment": "Eighth Step",      "Type": "Task",      "Parameters": {        "payload.$": "$.0.payload",        "step_name": "Step8",        "step_list.$": "$.0.step_list",        "parent_step.$": "$.0.parent_step"      },      "Resource": "https://us-central1-step-test-234405.cloudfunctions.net/step-test",      "TimeoutSeconds": 10,      "Catch": [{          "ErrorEquals": ["ErrStep8"],          "ResultPath": "$.error",          "Next": "Step8Failed"        }      ],      "Next": "Step8Succeeded"    },    "Step8Failed": {      "Type": "Fail",      "Error": "Step8FailedError"    },    "Step8Succeeded": {      "Type": "Succeed"    }  }}' --role-arn arn:aws:iam::0123456789:role/service-role/MyRole

aws stepfunctions --endpoint http://localhost:4584 start-execution --state-machine-arn arn:aws:states:local:0123456789:stateMachine:sample-state-machine55 --name my-execution44 --input '{"comment":"I am a great input !"}'```
chiradeep commented 5 years ago

×
←→1 of 2 errors on the page
TypeError: Cannot read property 'map' of undefined
Statemachine.render
src/pages/Statemachine.js:133
  130 |     <TableCell>Stop Date</TableCell>
  131 |   </TableRow>
  132 | </TableHead>
> 133 | <TableBody>
      | ^  134 |   {items.map((item, key) => (
  135 |     <TableRow key={item.executionArn + key}>
  136 |       <TableCell component="th" scope="row">
View compiled
▶ 17 stack frames were collapsed.
(anonymous function)
src/pages/Statemachine.js:86
  83 | }).then(res => res.json())
  84 |   .then(
  85 |     (result) => {
> 86 |       this.setState({
     | ^  87 |         isLoaded: true,
  88 |         items: result.executions,
  89 |         stateMachine: stateMachine
View compiled```
chiradeep commented 5 years ago

Unhandled Rejection (TypeError): Cannot read property 'map' of undefined
Statemachine.render
src/pages/Statemachine.js:133
  130 |     <TableCell>Stop Date</TableCell>
  131 |   </TableRow>
  132 | </TableHead>
> 133 | <TableBody>
      | ^  134 |   {items.map((item, key) => (
  135 |     <TableRow key={item.executionArn + key}>
  136 |       <TableCell component="th" scope="row">
View compiled
▶ 13 stack frames were collapsed.
(anonymous function)
src/pages/Statemachine.js:86
  83 | }).then(res => res.json())
  84 |   .then(
  85 |     (result) => {
> 86 |       this.setState({
     | ^  87 |         isLoaded: true,
  88 |         items: result.executions,
  89 |         stateMachine: stateMachine```
breathbath commented 5 years ago

If I execute both commands to create and execute a SM, I don't the the errors above. How exactly is it possible to reproduce them? You provide a wrong input and the statemachine fails on resolving the "payload" path but this situation is correctly displayed on the graph. If I provide the input sample from the code ({"step_name": "first_step","parent_step": "None","step_list": ["Start"],"payload": {}}) - everything works as well.

breathbath commented 5 years ago

I've updated the repo to replace fatal errors listed above with a more user friendly output.

chiradeep commented 5 years ago

fixes to the http server fixed all issues