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

fix: cookies of request for aws lambda payload format v2 #159

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

princescar
Copy link
Contributor

Put cookies back to headers to construct a complete request for hattip handler.

@cyco130
Copy link
Member

cyco130 commented Oct 19, 2024

Hi!

I don't understand the necessity of this. event.cookie seems to be purely for convenience, event.headers already seems to contain the cookie header as you can check below. It's a streaming AWS deployment of this test file. I also tested non-streaming version, works the same):

Maybe there's a configuration setting that I'm not aware that requires your patch?

@princescar
Copy link
Contributor Author

Hi @cyco130, I should mention that this is for the v2 payload format.

For the v2 payload, API gateway removes the Cookies header from event, and the hattip handler cannot get construct the full request with cookies.

References:

@princescar princescar changed the title fix: cookies of request for aws lambda fix: cookies of request for aws lambda payload format v2 Oct 27, 2024
@cyco130
Copy link
Member

cyco130 commented Oct 27, 2024

Hattip's also using v2. But if it's the API gateway that removes it, I wouldn't know because I don't use it (I just create a function URL and put it behind a CF worker, I'm cheap 😃).

How about only overwriting event.headers.cookie if it's empty (e.g. guard it with if (!event.headers.cookie) or something)? I'll merge if you can make a change to that effect.

Thanks for reporting!

@princescar
Copy link
Contributor Author

Hey @cyco130, it's updated!

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

Successfully merging this pull request may close these issues.

2 participants