-
Notifications
You must be signed in to change notification settings - Fork 38
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
fetch on server not including cookies (+page.server.ts) #42
Comments
Hey, do you use the fetch provided by the load function? If yes, you must manually inject the cookies in hooks.server.ts. export const handleFetch: HandleFetch = async ({event, request, fetch}) => {
if (request.url.startsWith(PUBLIC_API_URL)) {
request.headers.set("cookie", event.request.headers.get("cookie") ?? "");
}
return fetch(request);
} I'm kinda surprised it has worked for you in node tbh, it didn't for me. At least not when using the provided fetch. |
@kyngs, sorry for the confusion, I am not talking about the hooks - there I needed the add the cookies manually - even on node. I am talking about a fetch within a +page.server.ts ts (load()): Using the node adapter my cookies are passed to the backend, via credentials: 'include'. |
According to the sveltekit documentation the cookies should be passed from the client to the server fetch: |
This may be fixed now from Bun's 1.1.27 release. I'd be curious if it does fix this. |
Hey,
heaving the following code, the cookies on node are included.
After switching to bun, the cookies are not included anymore.
I tried to set the ORIGIN and add them manually via header, but for some reason no cookies at all reaches the backend (same tld).
Is there any way to work around this?
The text was updated successfully, but these errors were encountered: