-
Notifications
You must be signed in to change notification settings - Fork 5
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 getting cookies from headers. #41
Fix getting cookies from headers. #41
Conversation
I'm experiencing this issue and would love to see this being merged! |
@wingleung Is there anything I can do to help you review this PR? |
hey @gotgenes sorry for the late reply, thank you for the PR 🙏 I see other solutions that use headers.entries() instead which offers support from node.js 18 and up related to that, bumping the remix version in the |
b397ffb
to
3a5e651
Compare
@wingleung I updated the PR with your recommended changes. AFAICT this is working on the Node 20 Lambda runtime. |
@gotgenes just a question, how are you setting your headers? When I test it locally with following loader function I get a export const loader: LoaderFunction = () => {
const headers = new Headers();
headers.append("Set-Cookie", "cookie1=cookie1Value");
headers.append("Set-Cookie", "cookie2=cookie2Value");
return json({}, {
headers
})
} I believe we can remove the nested for loop here 👉 https://github.com/wingleung/remix-aws/pull/41/files#diff-6f39d6ba51b70c669d17f629bce999ac9f413e477a17f01ac8effd3f2d589c10L62 |
3a5e651
to
29acb94
Compare
@wingleung I'm sorry, you're correct. I've updated the PR to remove that inner loop. |
@gotgenes thank you! 🙏 merged to develop and published a beta version 👉 1.3.0-beta.1 |
Fixes an issue in the API Gateway v2 adapter where the call to
headers.raw()
throws the following error:As described in remix-run/remix#4354, the
headers.raw()
method is not available in theHeaders
class in Node.js. This change replaces theheaders.raw()
method withheaders.entries()
from the Fetch API to fix the issue.Edit: The original approach used
headers.getSetCookie()
, but @wingleung informed me this is not available in Node 18. The original PR also included dependency updates, which I since removed.