Open leaumar opened 1 month ago
Thanks @leaumar
@watany-dev @exoego @yiss or others. Can anyone handle this?
Thanks @leaumar I'll take look at it. What version of APIGateway are you using? V1 or v2?
@yiss our api is listed as a REST
type so googling actually tells me it's a V1.
What version of Hono are you using?
4.6.3
What runtime/platform is your app running on?
AWS lambda node20
What steps can reproduce the bug?
Having an api gateway that calls a lambda where hono is listening, a request like
GET http://.../helloworld?name=foo&name=bar
results in our hono handlers only receiving the last multivalue, i.e."bar"
instead of["foo","bar"]
in avalidator('query', ...)
middleware. We're aware of the difference betweenctx.req.query
andctx.req.queries
but we don't use either, onlyctx.req.valid('query')
.We receive the full multivalue if we run the same hono app locally (so only apigateway and lambda are removed). We can also revert our "upgrade" from koa to hono on the current infrastructure (the same lambda config etc, just different js), and then koa gives us the full multivalue. So it seems to us this must be an issue in hono's integration with api gateway, not something wrong in our infrastructure or call.
What is the expected behavior?
validator('query', ...)
should receive multivalue query paramsWhat do you see instead?
only a single value is passed
Additional information
We had a glance at the hono code and believe https://github.com/honojs/hono/blob/main/src/adapter/aws-lambda/handler.ts#L285 is the relevant code, where
multiValueQueryStringParameters
would have to be used somehow.But when we look at even the latest
@types/aws-lambda
,APIGatewayProxyEventV2
does not actually seem to have the field, contrary to what we understand from articles like this. InsteadAPIGatewayProxyEventMultiValueQueryStringParameters
is used onAPIGatewayProxyEventBase
whichAPIGatewayProxyEventV2WithRequestContext
doesn't extend. Our app does use an authorizer in front of our lambda andAPIGatewayProxyWithLambdaAuthorizerEvent
hasmultiValueQueryStringParameters
, but we're not sure if that helps at all.We don't really understand the reasoning in AWS' mess of payload types to be able to be more constructive, we never work with them, sorry. Maybe the most reasonable thing is for hono to just
if ("multiValueQueryStringParameters" in event) {
and parse it like here if true?Thanks