Skip to content
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

AWS Lambda Adapter only keeps requestContext from API GW event and loses the rest #1620

Closed
dbain-texada opened this issue Oct 25, 2023 · 8 comments · Fixed by #1710
Closed
Labels

Comments

@dbain-texada
Copy link

dbain-texada commented Oct 25, 2023

What version of Hono are you using?

3.8

What runtime/platform is your app running on?

NodeJS

What steps can reproduce the bug?

I've deployed my hono app to AWS lambda, however, it seems we lose the cookies from the request. I'm looking at this file: https://github.com/honojs/hono/blob/main/src/adapter/aws-lambda/handler.ts. Comparing a log of a lambda using hono vs log of a regular lambda, my hono lambda only has the requestContext while the regular lambda has the entire API GW event. Why doesn't the adapter retain the cookies?
image

What is the expected behavior?

I want hono context to retain more info from the API GW event rather than just the requestContext. What is the purpose of stripping this info?

What do you see instead?

Only the requestContext remains on the hono context after using the aws-lambda hono adapter

Additional information

No response

@yusukebe
Copy link
Member

cc: @watany-dev

@watany-dev
Copy link
Contributor

watany-dev commented Oct 25, 2023

As you pointed out, APIGatewayProxyEventV2 and other events are not capturing the complete event.
https://docs.aws.amazon.com/ja_jp/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html

@yusukebe
Should we address this by transcribing everything using this repository as a reference? I can handle it if it's from next week onward.
https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/aws-lambda

@yusukebe
Copy link
Member

@watany-dev

Should we address this by transcribing everything using this repository as a reference? I can handle it if it's from next week onward.

Is that a lot of it?

@watany-dev
Copy link
Contributor

@yusukebe

Actually, if it is just the cookie in this case, this PR will fix it.

#1613

I don't know how much to port all the lambda event interfaces, but it might not be that much, so I'll try to make a PR somewhere.

@yusukebe
Copy link
Member

@watany-dev

I see!

Once things are done, I'll merge #1613 into main. And if you can, please create the PR to port all Lambda event interfaces. Thanks!

@dbain-texada
Copy link
Author

That's awesome, thank you both for your inputs!

@watany-dev
Copy link
Contributor

@yusukebe
I think this issue should be closed. What do you think?

@yusukebe
Copy link
Member

Yeah, we can close it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants