You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hooking up a Mangum lambda to CloudFront as EventType: origin-request returns a 502 response: "The Lambda function result failed validation: The function tried to add, delete, or change a read-only header."
According to the documentation, the Content-Length Header is one of the read-only headers for origin-request events. Not quite sure why. But it's certainly one of the headers returned when calling the lambda. I use the lambda to handle API requests, so it needs IncludeBody, which is only available with origin-request.
I was able to get around this by hijacking the response:
Thanks @UnderSampled for the report and example workaround. I won't be able to look into it myself at this time, but I would be willing to review and merge any PRs to address these rules in the handler itself.
Hooking up a Mangum lambda to CloudFront as
EventType: origin-request
returns a 502 response: "The Lambda function result failed validation: The function tried to add, delete, or change a read-only header."According to the documentation, the
Content-Length
Header is one of the read-only headers fororigin-request
events. Not quite sure why. But it's certainly one of the headers returned when calling the lambda. I use the lambda to handle API requests, so it needsIncludeBody
, which is only available with origin-request.I was able to get around this by hijacking the response:
The text was updated successfully, but these errors were encountered: