T
TanStack7mo ago
adverse-sapphire

Is deleteCookie blocking?

import { deleteCookie, getCookie, setCookie } from "@tanstack/start/server";

if (sessionCookie) {
// Kill the session cookie for this user
console.log("Going to delete the session cookie!!");
const idToken = await serverAuth.verifySessionCookie(sessionCookie);
await serverAuth.revokeRefreshTokens(idToken.uid);
deleteCookie("session");

if (getCookie("session")) {
console.error("Failed to delete session cookie");
}
}
import { deleteCookie, getCookie, setCookie } from "@tanstack/start/server";

if (sessionCookie) {
// Kill the session cookie for this user
console.log("Going to delete the session cookie!!");
const idToken = await serverAuth.verifySessionCookie(sessionCookie);
await serverAuth.revokeRefreshTokens(idToken.uid);
deleteCookie("session");

if (getCookie("session")) {
console.error("Failed to delete session cookie");
}
}
Every time I get the console error for "Failed to delete session cookie"
3 Replies
xenial-black
xenial-black7mo ago
these functions just wrap h3
xenial-black
xenial-black7mo ago
Handle Cookie - h3
Use cookies to store data on the client.
xenial-black
xenial-black7mo ago
you cannot "delete" the cookie from the request you can just omit it in the response

Did you find this page helpful?