Step Function Gateway Integration - Response Header

0

I use a Step Function integrated into an API Gateway endpoint. The Step Functions last Task is a Lambda Function. Based on a calculation in the last Task I want to set a response header. The problem that I'm facing is that the standard way of mapping the header doesn't work: integration.response.body.JSONPathExpression

The problem is that the output of a task is always parsed to a json string and can not be accessed via integration.response.body. I can only access the complete Json string: integration.response.body.output

But I can not access any nested properties because it's just a Json string.

Has anyone else faced a similar problem and solved it?

1 Antwort
0

You may need to use mapping templates and use $util.parseJson().

profile pictureAWS
EXPERTE
Uri
beantwortet vor 3 Monaten
  • Thank you for your answer. The problem is that the mapping template is applied after the header mapping. So mapping the application/json has no influence on my header mapping.

  • That is true, but you can override the value of a header inside the mapping template using $context.responseOverride.header.header_name. See more here

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen