New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression caused by multiHeaderValue handling on Lambda #2550
Comments
We are also experiencing issues due to this bug, primarily we're impacted by this causing the JWT middleware to no longer function. The JWT middleware verifies that the Of course, with this duplicate header issue the https://github.com/honojs/hono/blob/main/src/middleware/jwt/index.ts#L33 As a workaround we've created a custom middleware to wrap calling the JWT middleware, before executing the JWT middleware we're using this "lovely hacky" line to map the original single header value back into the request headers in the same way the AWS lambda adapter does. c.req.raw.headers.set('Authorization', c.env.event.headers['Authorization']); |
Not sure if anyone else has a better idea, but our thoughts are that the code that is setting headers from the https://github.com/honojs/hono/blob/main/src/adapter/aws-lambda/handler.ts#L206 |
Thanks for your comment. I will fix this. |
Same bug here Maybe @ShaneYu 's approach would be good |
What version of Hono are you using?
4.2.5
What runtime/platform is your app running on?
AWS
What steps can reproduce the bug?
#2494 introduced the handling of multiHeaderValues. However, this seemed to have caused header duplication. On AWS, using API Gateway, a header is put both in
headers
and inmultiValueHeaders
when using proxy integration (even single value ones). The handling introduced in #2494 adds both to the headers array, causing duplicates. As a result, header values are concatenated with commas.Example output from API Gateway test console:
As you can see, the same header is in both collections, even though provided only once.
What is the expected behavior?
No header value duplication.
What do you see instead?
Duplicate header values:
Additional information
No response
The text was updated successfully, but these errors were encountered: