Skip to content

Commit

Permalink
fix: do not print warning if context injection is already set up
Browse files Browse the repository at this point in the history
  • Loading branch information
lym953 committed Sep 16, 2024
1 parent 27109b8 commit 4dd3720
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/commands/stepfunctions/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,16 @@ check out https://docs.datadoghq.com/serverless/step_functions/troubleshooting/\
return true
}

// context injection is already set up
if (step.Parameters['Payload.$'] === 'States.JsonMerge($$, $, false)') {
context.stdout.write(` Step ${stepName}: Context injection is already set up. Skipping context injection.\n`)

return false
}

// custom payload
context.stdout
.write(`[Warn] Step ${stepName} has a custom Payload field. Step Functions Context Object injection skipped. \
.write(`[Warn] Step ${stepName}: has a custom Payload field. Step Functions Context Object injection skipped. \
Your Step Functions trace will not be merged with downstream Lambda traces. To manually merge these traces, \
check out https://docs.datadoghq.com/serverless/step_functions/troubleshooting/\n`)

Expand Down Expand Up @@ -203,6 +210,13 @@ merge these traces, check out https://docs.datadoghq.com/serverless/step_functio
return true
}

// context injection is already set up
if (step.Parameters.Input['CONTEXT.$'] === 'States.JsonMerge($$, $, false)') {
context.stdout.write(` Step ${stepName}: Context injection is already set up. Skipping context injection.\n`)

return false
}

context.stdout
.write(`[Warn] Step ${stepName}'s Parameters.Input field has a custom CONTEXT field. Step Functions Context \
Object injection skipped. Your Step Functions trace will not be merged with downstream Step Function traces. To \
Expand Down

0 comments on commit 4dd3720

Please sign in to comment.