Ask questionsMultiple ways to invoke Lambda function as a Step Functions task

<!-- short description of the feature you are proposing: -->

There are currently multiple ways to invoke a Lambda function through Step Functions tasks

InvokeFunction - initial offering by Step Functions to invoke a Lambda function. RunLambdaTask - latest mechanism to invoke a Lambda function. includes all the functionality as InvokeFunction but also enables the capability to pause a workflow until a task token is returned or fire and forget.

Both of these mechanisms are valid in the Amazon States Language

Proposed Solution

<!-- Please include prototype/workaround/sketch/reference implementation: -->

  • Mark the InvokeFunction task as as deprecated and guide users towards using the newer RunLambdaTask. This solution is less abrasive than simply removing the legacy mechanism as there are likely customers who will not want to be forced to migrate.


<!-- e.g. detailed explanation, stacktraces, related issues, suggestions on how to fix, links for us to have context, eg. associated pull-request, stackoverflow, gitter, etc -->

  • [x] :wave: I may be able to implement this feature request
  • [ ] :warning: This feature might incur a breaking change

This is a :rocket: Feature Request


Answer questions eikeon

Upgraded to version 1.36.1 to switch to and test RunLambdaTask. I'm now able to get the right input to the lambda, but I'm not able to return the lambda's output as the task output via adding outputPath: "$.Payload", to the sfn.Task. The current overview has the following example

new sfn.Task(this, 'Invoke and set function response as task output', {
  task: new tasks.RunLambdaTask(myLambda, {
    payload: sfn.TaskInput.fromDataAt('$'),
  outputPath: '$.Payload',

. When doing so I get

  "error": "States.Runtime",
  "cause": "An error occurred while executing the state 'Get Object' (entered at the event id #2). Invalid path '$.Payload' : No results for path: $['Payload']"

Related questions

Issues compiling CDK projects ("TS2300: Duplicate identifier 'IteratorResult'")
cli: cdk deploy issue hot 3
Subnet selection returns more than one per AZ hot 2
cli: synth fails if cdk.out does not exist hot 2
Default policy are getting creating even when Managed policy were created in the Role hot 1
Python dependency libraries are set to latest hot 1
using json instead of a string as context in cdk.json hot 1
Attaching Managed Policy to Role failing hot 1
Access denied when adding an event notification to an existing s3 bucket hot 1
Unable to create CfnSpotFleet using Python hot 1
DBClusterParameterGroup not found: default.aurora5.6 hot 1
aws-ecs: Cannot deploy fargate services with ECR images hot 1
ecs_patterns.ApplicationLoadBalancedFargateService should allow specifying healthCheck path - aws-cdk hot 1
CodeCommitSourceAction tries to add a policy to an imported role hot 1
Using getAtt that returns a list within a string that is joined in the generated template throws an error hot 1
Github User Rank List