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

Internal server error when setting multiple header values #29

Closed
TheCallSign opened this issue Jan 12, 2021 · 2 comments · Fixed by #31
Closed

Internal server error when setting multiple header values #29

TheCallSign opened this issue Jan 12, 2021 · 2 comments · Fixed by #31
Assignees
Labels
bug Something isn't working
Projects

Comments

@TheCallSign
Copy link
Contributor

TheCallSign commented Jan 12, 2021

Hi,

I've been debugging an issue we've been having using nextauth routes. The api routes (/api/auth/[...nextauth]) served by the nextauth library were all responding with an HTTP error 500. I've narrowed down the issue to nextauth setting two cookies, which in turn sets the header set-cookie to contain two values in the header object returned to API Gateway (see source).

AWS API Gateway v1 requires headers with multiple values to be set in multiValueHeaders key and rejects multi value headers that are set in headers.

I would write a patch myself but I am struggling to test the changes to the respective bridge function.

Please let me know if I have missed something.

@ofhouse
Copy link
Member

ofhouse commented Jan 13, 2021

Hi, thanks for digging down on this.

Since the last 2 releases we use a custom fork of now-node-bridge to provide a better customization for API Gateway (Located here: https://github.com/dealmore/terraform-aws-next-js/blob/main/packages/node-bridge/src/bridge.ts).

But since it only passes the headers like the Vercel version the bug is present there as well (L238).

I will take a deeper look later today, we should be able to reproduce the behavior in our unit and e2e tests.

@ofhouse ofhouse added the bug Something isn't working label Jan 13, 2021
@ofhouse ofhouse self-assigned this Jan 13, 2021
@ofhouse ofhouse added this to To do in Tasks Jan 13, 2021
@ofhouse ofhouse moved this from To do to In progress in Tasks Jan 13, 2021
ofhouse added a commit that referenced this issue Jan 16, 2021
Fixes issues with multi value headers (#29)
@ofhouse
Copy link
Member

ofhouse commented Jan 16, 2021

Fix is now released in v0.6.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
Tasks
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants