Getting error when using local amplify mock api: The request has a 'X-Amzn-Trace-Id' HTTP header which is reserved for AWS X-Ray trace header

0

I am currently using Amplify to set up my backend because Appsync is a key part of my stack.

However, I also use SQS to publish certain messages into a queue. This is easily done using the in-code editor of lambda but since I'm running lambda functions locally now, I am unable to send messages to the queue now with the following error:

InvalidParameterValue: The request has a 'X-Amzn-Trace-Id' HTTP header which is reserved for AWS X-Ray trace header and has an invalid value 'amplify-mock-x-amzn-trace-id'

This is my code to send messages into the queue.

response = await sqs.sendMessageBatch(slackParams).promise().catch(async (err) => { console.log(response from sqs: ${err}); });

Once I do amplify push, the code works fine on the cloud lambda but the issue comes only when I do amplify mock api. (During local testing, I am unable to add to the queue)

Is there any way I can mock my SQS setup locally as well? Any help is appreciated!

1 Answer
0

Hi,

Is this InvalidParameterValue error coming from SQS? Looks like the issue stems from Amplify setting the 'X-Amzn-Trace-Id' to 'amplify-mock-x-amzn-trace-id', which may be an improper format when you send to SQS. Could you try removing the 'X-Amzn-Trace-Id' in the request for these tests if you aren't interested in tracing during testing?

AWS
Jon_L
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions