If Payload.$ doesn't exist, then inject context using States.JsonMerge($$, $, false)
We don't check if Payload exists. The current behavior when Payload exists is that we also try to inject context using States.JsonMerge($$, $, false). Then there would be an error when serverless deploy is run, saying Payload and Payload.$ can't both exist, which can be confusing to users.
What does this PR do?
Change context injection behavior so that if Payload.$ or Payload don't exist, then inject context using:
Current behavior:
In the Lambda step definition,
Payload.$
doesn't exist, then inject context usingStates.JsonMerge($$, $, false)
Payload
exists. The current behavior whenPayload
exists is that we also try to inject context usingStates.JsonMerge($$, $, false)
. Then there would be an error whenserverless deploy
is run, sayingPayload
andPayload.$
can't both exist, which can be confusing to users.What does this PR do?
Change context injection behavior so that if
Payload.$
orPayload
don't exist, then inject context using:This corresponds to Case 1 in the design doc Fixing Step Function Instrumentation
Motivation
Testing Guidelines
Automated tests
Passed the existing and added tests
Manual tests
Steps
Create a State Machine with a Lambda step which has no Payload or Payload.$
Run
serverless deploy
.Check the State Machine definition in AWS UI
Result
Context was injected as expected:
Additional Notes
Types of changes
Check all that apply