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개 답변
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
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠