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

Inject context for sfn->Lambda when no Payload exists (case 1) #1460

Merged
merged 1 commit into from
Sep 18, 2024

Conversation

lym953
Copy link
Contributor

@lym953 lym953 commented Sep 16, 2024

What and why?

In Step Machine definition, if a Lambda function doesn't have Payload field, right now we are injecting context using

"Payload.$": "States.JsonMerge($$, $, false)"

This PR changes it to:

"Payload.$": "$$['Execution', 'State']"

which passes less information.

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

Testing

Automated testing

Pass the touched tests

Manual testing

Steps
  1. Make the Lambda Execution step have no Payload field
  2. Build the package: yarn prepack
  3. Instrument the Step Function using ./dist/cli.js stepfunctions instrument
  4. Execute the State Machine
Result
  1. "Payload.$": "$$['Execution', 'State']" was added to Lambda definition
  2. TODO: question to reviewers: What product should we check to ensure context injection works this way?

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 16, 2024
@lym953 lym953 requested review from a team as code owners September 16, 2024 22: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-8
Commit report: f7222ff
Test service: datadog-ci-tests

✅ 0 Failed, 376 Passed, 0 Skipped, 1m 27.44s Total duration (2m 2.41s 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-7 to master September 18, 2024 16:44
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.

I think we should hold off on removing StateMachine from the schema for now

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.

thanks for updating!

@lym953 lym953 merged commit 2698227 into master Sep 18, 2024
18 checks passed
@lym953 lym953 deleted the yiming.luo/fix-step-func-8 branch September 18, 2024 18:51
@lym953 lym953 changed the title Inject context for xfn->Lambda when no Payload exists (case 1) Inject context for sfn->Lambda when no Payload exists (case 1) 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