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 Antwort
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
beantwortet vor 2 Jahren

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