Origin Request Lambda Returns 400

0

Hi,

I have an issue with an Origin Request Lambda@Edge lambda. After it returns the modified request object the request throws an error and returns a 400. (I checked the requests never reached the Origin) and also the x-cache header of the response is "Error from CloudFront".

Now I have a suspicion that the reason for that behavior is that the uri field is the following - "uri": "/cohesionapi/entity-preview/[media-reference:media:e44cf764-a581-4e26-903d-fc0ef5369738]" - do you think that the [ would break CloudFront, or is it a valid response/request to make?

Thanks Sandor

질문됨 2년 전897회 조회
1개 답변
0

I am not sure about the URI format, but a few things to try to get started:

  1. Can you look at the 400 response body? Sometimes the response error body has useful information that can point in the right direction. Try pulling the URL up in a browser.
  2. The Error from CloudFront means the request is probably malformed, which might align with your theory on the uri format. If it was an issue with the Lambda logic you would likely get a 502 and the x-cache header would be LambdaValidationError or LambdaExecutionError.
  3. Is there anything meaningful in the CloudWatch logs that might point you in the right direction?
  4. Consider logging the event object at the end of your L@E function. I am not sure which language you are using, but for node I usually do something like the following. You should see the output in the CloudWatch logs which might point to the issue. Start by checking the event.request.origin object to see if everything looks correct there.

console.log(JSON.stringify(event));

profile pictureAWS
답변함 2년 전

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

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

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

관련 콘텐츠