What version of Hono are you using?
4.5.3
What runtime/platform is your app running on?
aws lambda
What steps can reproduce the bug?
Create a HTTP Api proxy v2 endpoint in aws-lambda and use a lambda authorizer in front of it, but practically since this is a typings issue you can set up your bindings like:
type Bindings = {
Bindings: { event: LambdaEvent, lambdaContext:LambdaContext };
Variables: { userId: string };
};
const app = new Hono<Bindings>();
Then try and set a value from the lambda authorizer context
app.use(async (ctx, next) => {
ctx.set(
"userId",
ctx.env.event.requestConstext.authorizer.lambda.userId
);
});
This throws up TS warnings because the current setup of LambdaEvent only has a key for iam auth.
What is the expected behavior?
I would expect the types to work correctly.
What do you see instead?
A typescript error.
My current workaround is to do this:
type Event = LambdaEvent & {
requestContext: {
authorizer: {
lambda: { userId: string };
}
}
};
type Bindings = {
Bindings: { event: Event, lambdaContext:LambdaContext };
Variables: { userId: string };
};
Additional information
I referenced @types/aws-lambda to figure out typings here.
What version of Hono are you using?
4.5.3
What runtime/platform is your app running on?
aws lambda
What steps can reproduce the bug?
Create a HTTP Api proxy v2 endpoint in aws-lambda and use a lambda authorizer in front of it, but practically since this is a typings issue you can set up your bindings like:
Then try and set a value from the lambda authorizer context
This throws up TS warnings because the current setup of
LambdaEventonly has a key for iam auth.What is the expected behavior?
I would expect the types to work correctly.
What do you see instead?
A typescript error.
My current workaround is to do this:
Additional information
I referenced @types/aws-lambda to figure out typings here.