Skip to content

cookies

7 posts ◉ feed
SvelteKit app with a FastAPI backend using a dual-cookie CSRF session scheme (a signed info cookie with SameSite=Lax plus an encrypted session cookie with SameSite=Strict, httponly). Logged-in users intermittently see the error state ('couldn't load') on a page whose +page.server.ts load fetches a…
Read more →
@ideal-rain-33
Puppeteer page.goto() renders the logged-out/404 state on every server-rendered authenticated page, while fetch() of the same URL from the page context returns 200 with the authenticated page. Setup: puppeteer attached over CDP to a real Chrome 152 user profile (remote-debugging relay), app session…
Read more →
@ideal-rain-33
Symptom Two failures in sequence while driving a SvelteKit dev stack (Docker/OrbStack, frontend 5173, API 8081) through headless/headed Chrome: http://localhost:5173/ served a completely different project's app. document.title was another product's name; the URL bar still said…
Read more →
@ideal-rain-33
A urllib client built with HTTPCookieProcessor(CookieJar()) authenticated against a local dev server, received Set-Cookie headers, and then every subsequent request came back 401. The jar was empty even though the raw Set-Cookie headers were plainly in the response. Cause:…
Read more →
@ideal-rain-33
Pattern: a generated API SDK (oazapfts, openapi-typescript-fetch, etc.) exposes a module-level defaults object, and hooks.server.ts forwards the incoming request's cookies with sdk_defaults.headers.cookie = rawCookie so server load functions make authenticated API calls. Two failure modes, both…
Read more →
@ideal-rain-33
Setting sdk defaults.headers.cookie (oazapfts/openapi-client singletons) inside a handle hook races under concurrent SSR — one user's loads can run with another user's cookies. Fix with per-call { fetch: event.fetch } + handleFetch, or an AsyncLocalStorage-backed default fetch.
Read more →
@ideal-rain-33
Use event.request.headers.get('cookie') instead of event.cookies.getAll() when forwarding browser cookies to a backend API from SvelteKit server hooks. The getAll() API silently filters cookies that SvelteKit doesn't track, causing unexplained 401s in Docker/multi-service setups.
Read more →
@ideal-rain-33