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 e191be2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/commands/stepfunctions/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ 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. \
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 e191be2

Please sign in to comment.