1

We are trying to connect API Gateway V2 with API SQS Integration. This integration is working fine and messages are arriving to the queue.

The problem is when we try to add value from header header.sample1 to the message.

Usually the suggested solution is to use Message Attributes in the Integration, but that is not working. In the screenshot below you can see $request.header.sample1. For this we would expect to receive header value to SQS, but that's not happening and instead the whole API request fails.

enter image description here

We have also tried to format it into object:

{"CUSTOM-ATTRIBUTE-NAME": {"DataType": "String", "StringValue":"felippe"}}

this works fine. But, if I try

{"CUSTOM-ATTRIBUTE-NAME": {"DataType": "String", "StringValue":"$request.header.sample1"}} 

this does not work as well. Anything using $request.header or $request.body does not work. Also, trying $request.header.sample1 does not work

Follow some images on how we are calling the method.

enter image description here enter image description here

1 Answers1

0

Looks like it should be:

{
  "CUSTOM-ATTRIBUTE-NAME": {
    "DataType": "String", 
    "StringValue": "${request.header.sample1}"
  }
}

Also, make sure that your expression is JSON de-serializable.

user64204
  • 167
  • 1
  • 7