Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip sfn->Lambda context injection of Payload is not object (case 3) #1461

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

lym953
Copy link
Contributor

@lym953 lym953 commented Sep 18, 2024

What

In a State Machine, if a Lambda execution step's Payload field is not a JSON object, e.g.

    "Lambda Invoke": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "OutputPath": "$.Payload",
      "Parameters": {
        "FunctionName": "arn:aws:lambda:sa-east-1:425362996713:function:yimingPlayground",
        "Payload": "Just a string!"
      },
      "Next": "Step Functions StartExecution"
    },

then print a warning and skip context injection.

This is case # 3 in this design doc: Fixing Step Function Instrumentation

Why

To inject context into Lambda payload, the payload must be a JSON dictionary. Injection can't work if payload is a string.

Testing

Automated testing

Passed the added test and existing tests

Manual testing

Steps
  1. Change the Lambda Execution step to have a string Payload field as shown in the "What" section
  2. Build the package: yarn prepack
  3. Instrument the Step Function using ./dist/cli.js stepfunctions instrument
Result

A warning is printed:
image

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)

@lym953 lym953 added enhancement New feature or request serverless Related to [lambda, stepfunctions, cloud-run] labels Sep 18, 2024
@lym953 lym953 requested review from a team as code owners September 18, 2024 16:33
@lym953 lym953 changed the title Skip xfn->Lambda context injection of Payload is not object Skip xfn->Lambda context injection of Payload is not object (case 3) Sep 18, 2024
@lym953 lym953 force-pushed the yiming.luo/fix-step-func-8 branch 3 times, most recently from f001b4f to f7222ff Compare September 18, 2024 18:19
@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Sep 18, 2024

Datadog Report

Branch report: yiming.luo/fix-step-func-10
Commit report: 65bed16
Test service: datadog-ci-tests

✅ 0 Failed, 2522 Passed, 0 Skipped, 2m 12.08s Total duration (1m 29.18s time saved)

Copy link
Contributor

@avedmala avedmala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Base automatically changed from yiming.luo/fix-step-func-8 to master September 18, 2024 18:51
@lym953 lym953 merged commit 7620415 into master Sep 18, 2024
18 checks passed
@lym953 lym953 deleted the yiming.luo/fix-step-func-10 branch September 18, 2024 18:58
@lym953 lym953 changed the title Skip xfn->Lambda context injection of Payload is not object (case 3) Skip sfn->Lambda context injection of Payload is not object (case 3) Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request serverless Related to [lambda, stepfunctions, cloud-run]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants