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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南