By using AWS re:Post, you agree to the Terms of Use

Questions tagged with AWS Step Functions

Sort by most recent
  • 1
  • 12 / page

Browse through the questions and answers listed below or filter and sort to narrow down your results.

State Machine times-out on Choice

I updated my state machine to use a task token and now it's timing out when it gets to the choice. This was previously working, and the cloudwatch logs for the first supportticketparse lambda function aren't indicating that anything is wrong. My guess is that I have and error in the payload definition, but I'm not sure. Is anything obviously wrong with the definition? If not, where else can I look for a potential problems? ``` { "Comment": "A description of my state machine", "StartAt": "zen sort", "TimeoutSeconds": 60, "States": { "zen sort": { "Type": "Task", "Resource": "arn:aws:states:::lambda:invoke.waitForTaskToken", "OutputPath": "$.Payload", "Parameters": { "FunctionName": "arn:aws:lambda:us-east-1:363540650061:function:support-ticket-parse:$LATEST", "Payload": { "ExecutionContext.$": "$$", "APIGatewayEndpoint": "https://9084s1lza7.execute-api.us-east-1.amazonaws.com/test/", "Payload.$": "$" } }, "Next": "Choice" }, "Choice": { "Type": "Choice", "Choices": [ { "Variable": "$.name", "StringMatches": "New User Account ", "Next": "send email" }, { "Not": { "Variable": "$.name", "StringMatches": "New User Account " }, "Next": "Fail" } ], "Default": "Fail" }, "send email": { "Type": "Task", "Resource": "arn:aws:states:::lambda:invoke.waitForTaskToken", "OutputPath": "$.Payload", "Parameters": { "FunctionName": "arn:aws:lambda:us-east-1:363540650061:function:send_email:$LATEST", "Payload": { "ExecutionContext.$": "$$", "APIGatewayEndpoint": "https://9084s1lza7.execute-api.us-east-1.amazonaws.com/test/", "Payload.$": "$" } }, "Retry": [ { "ErrorEquals": [ "Lambda.ServiceException", "Lambda.AWSLambdaException", "Lambda.SdkClientException" ], "IntervalSeconds": 2, "MaxAttempts": 6, "BackoffRate": 2 } ], "End": true }, "Fail": { "Type": "Fail" } } } ```
2
answers
0
votes
46
views
asked 13 days ago

The security token included in the request is invalid

Hi, I have nested workflow for Step Functions where the outer state machine awaits for the inner state machine to return task token. Definitions: Outer State machine: ``` { "Comment": "A description of my state machine", "StartAt": "ChildProcessing", "States": { "ChildProcessing": { "Type": "Task", "Resource": "arn:aws:states:::states:startExecution.waitForTaskToken", "Parameters": { "StateMachineArn": "arn:aws:states:us-east-1:123456789012:stateMachine:child", "Input": { "parentTaskToken.$": "$$.Task.Token", "AWS_STEP_FUNCTIONS_STARTED_BY_EXECUTION_ID.$": "$$.Execution.Id" } }, "ResultPath": "$.output", "Next": "PostJobSuccess" }, "PostJobFailure": { "Type": "Task", "Resource": "arn:aws:states:::sqs:sendMessage", "Parameters": { "MessageBody.$": "$$.Execution.Input", "QueueUrl": "http://queueurl" }, "End": true }, "PostJobSuccess": { "Type": "Task", "Resource": "arn:aws:states:::sqs:sendMessage", "Parameters": { "MessageBody.$": "$$.Execution.Input", "QueueUrl": "http://queueurl" }, "End": true } } } ``` Inner State machine: ``` { "Comment": "Child processing.", "StartAt": "GetJobStatus", "States": { "GetJobStatus": { "Type": "Task", "Resource": "arn:aws:states:::sqs:sendMessage.waitForTaskToken", "TimeoutSeconds": 120, "Parameters": { "QueueUrl": "http://childqueueurl", "MessageAttributes": { "jobName": { "DataType": "String", "StringValue": "AsyncProcessingJob" } }, "MessageBody": { "taskToken.$": "$$.Task.Token", "machineExecutionId.$": "$$.Execution.Id" } }, "ResultSelector": { "input.$": "$$.Execution.Input.input", "parentTaskToken.$": "$$.Execution.Input.parentTaskToken" }, "Next": "CheckJobStatus" }, "CheckJobStatus": { "Type": "Choice", "Choices": [ { "Variable": "$.jobStatus", "StringMatches": "finished", "Next": "SendTaskSuccess" }, { "Variable": "$.jobStatus", "StringMatches": "failed", "Next": "SendTaskFailure" } ] }, "SendTaskFailure": { "Type": "Task", "Parameters": { "TaskToken.$": "$$.Execution.Input.parentTaskToken" }, "Resource": "arn:aws:states:::aws-sdk:sfn:sendTaskFailure", "End": true }, "SendTaskSuccess": { "Type": "Task", "Parameters": { "Output.$": "$.input", "TaskToken.$": "$$.Execution.Input.parentTaskToken" }, "Resource": "arn:aws:states:::aws-sdk:sfn:sendTaskSuccess", "End": true } } } ``` Here is my `aws-stepfunctions-local-credentials.txt` with fake credentials and setting STEP_FUNCTIONS_ENDPOINT to http://localhost:8083 ``` AWS_DEFAULT_REGION=us-east-1 AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test AWS_SESSION_TOKEN=test STEPFUNCTIONS_PORT=8083 STEP_FUNCTIONS_ENDPOINT=http://localhost:8083 STEPFUNCTIONS_HOST=stepfunctions-local ``` While executing this nested workflow, I am getting the error: ``` {"Type":"TaskSubmitFailed","PreviousEventId":22,"TaskSubmitFailedEventDetails":{"ResourceType":"aws-sdk","Resource":"sfn:sendTaskSuccess","Error":"Sfn.SfnException","Cause":"software.amazon.awssdk.services.sfn.model.SfnException: The security token included in the request is invalid. (Service: Sfn, Status Code: 400, Request ID: 864f4abc-6e26-4ce7-9cfa-63ade13dd6ca)"}} ``` Has anyone come across similar issue and found solution?
3
answers
0
votes
66
views
asked a month ago

Scaling AWS step-functions and comprehend jobs with Concurrent active asynchronous jobs quota

1. I am trying to implement a solution that integrates aws comprehend targeted sentiment along with step functions. And then make it public for people to use it as an api. 2. I need to wait until the job is complete before being able to move forward with the workflow. Since the comprehend job is asynchronous, **I created a wait time poller to periodically check the jobs status** using describe_targeted_sentiment_detection_job. Following a similar integration pattern as this https://docs.aws.amazon.com/step-functions/latest/dg/sample-project-job-poller.html. 3. However, there is seems to be a **Concurrent active asynchronous jobs quota of 10 jobs** according to https://docs.aws.amazon.com/comprehend/latest/dg/guidelines-and-limits.html#limits-active-jobs. If this is the case, I was thinking of **creating another poll to check if comprehend is free to do targeted sentiment before starting another comprehend job** 4. Given that the step functions charge for each polling cycle. And that there is a concurrent job limit of 10. I am worried about the backlog and respective costs that may be created if many step-function executions were to be started. For example, if 1000 workflows are started. Workflow number 1000 will have to be polling for an available comprehend job for a long time. Does anyone know if a solution is available to get around the concurrent active asynchronous jobs quota or to reduce the cost of step functions continually polling for a long time?
1
answers
0
votes
41
views
asked a month ago
  • 1
  • 12 / page