bref icon indicating copy to clipboard operation
bref copied to clipboard

Detect oversized invocation payloads (request line + headers)

Open timkelty opened this issue 4 months ago • 1 comments

An app responding with a large amount/length of headers can cause the "request line and header values" to exceed 1MB:

https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html

1 MB for the total combined size of request line and header values 

That is a bit ambiguous, but I guess and header values must mean the request and response headers?

When this happens, it is very hard to diagnose what is happening. You'll end up with the normal START, REPORT END logs in Cloudwatch, but no errors.

The response looks like this:

HTTP/1.1 502 Bad Gateway
Connection: keep-alive
Content-Length: 122
Content-Type: text/html
Date: Wed, 20 Aug 2025 13:03:25 GMT
Server: awselb/2.0

<html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
</body>
</html>

It would be nice if Bref detected this and threw an invocation exception, like it does for oversized body payloads (6mb).

timkelty avatar Aug 20 '25 13:08 timkelty

Upon further investigation – it seems like we may actually be seeing this as a result of these ALB limits (using Lambda URLs), which are much lower. (16kb/header, 32kb total).

timkelty avatar Oct 31 '25 03:10 timkelty