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

feat: Support sfn->Lambda context injection when Payload.$ exists (case 4) #531

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

lym953
Copy link
Contributor

@lym953 lym953 commented Sep 26, 2024

What does this PR do?

Handles context injection from Step Function to Lambda Invoke step when Payload.$ is set.

  • Case 4.1: default Payload "Payload.$": "$": change to "Payload.$": "States.JsonMerge($$, $, false)"
  • Case 4.2: already injected: "Payload.$": "States.JsonMerge($$, $, false)" or "$$['Execution', 'State', 'StateMachine']": do nothing
  • Case 4.3: Payload.$ has other values: print a warning and skip context injection

This corresponds to Case 4 in the design doc Fixing Step Function Instrumentation

Motivation

Testing Guidelines

Passed the existing and added tests

Additional Notes

Types of changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog

@lym953 lym953 requested a review from a team as a code owner September 26, 2024 15:46
);
return;
}

serverless.cli.log(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Deleting this code because it's unreachable.
BTW I will refactor this function to make it hopefully more clear.

@lym953 lym953 force-pushed the yiming.luo/fix-sfn-context-injection-9 branch from d6e5f3f to 95a8379 Compare September 26, 2024 16:00
Copy link

@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 🚢

@lym953
Copy link
Contributor Author

lym953 commented Sep 27, 2024

/merge

@dd-devflow
Copy link

dd-devflow bot commented Sep 27, 2024

🚂 MergeQueue: pull request added to the queue

The median merge time in main is 2m.

Use /merge -c to cancel this operation!

@dd-mergequeue dd-mergequeue bot merged commit 0e15305 into main Sep 27, 2024
14 checks passed
@dd-mergequeue dd-mergequeue bot deleted the yiming.luo/fix-sfn-context-injection-9 branch September 27, 2024 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants