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
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 a validator('query', ...) middleware. We're aware of the difference between ctx.req.query and ctx.req.queries but we don't use either, only ctx.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 params
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. Instead APIGatewayProxyEventMultiValueQueryStringParameters is used on APIGatewayProxyEventBase which APIGatewayProxyEventV2WithRequestContext doesn't extend. Our app does use an authorizer in front of our lambda and APIGatewayProxyWithLambdaAuthorizerEvent has multiValueQueryStringParameters, 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
The text was updated successfully, but these errors were encountered:
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
The text was updated successfully, but these errors were encountered: