Open Cluster2a opened 12 months ago
Hey, do you use the fetch provided by the load function? If yes, you must manually inject the cookies in hooks.server.ts. For example:
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: https://kit.svelte.dev/docs/load#cookies
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?