I’m using a astroJS action to destroy a cookie when someone logs out. Works on local host and looks like this:
logoutUser: defineAction({
handler: (_, context) => {
const TOKEN = import.meta.env.TOKEN
try {
context.cookies.set(TOKEN, '', {
httpOnly: true,
maxAge: 0,
path: '/',
secure: true,
sameSite: 'lax',
})
return true
} catch (error) {
console.error('Error logging out: ', error)
throw new Error(error.message || error)
}
},
}),
When I click the button to logout on my app deployed with vercel I get:
17:03:11 [ERROR] SyntaxError: Unexpected end of JSON input at JSON.parse () at parseJSONFromBytes (node:internal/deps/undici/undici:5584:19) at successSteps (node:internal/deps/undici/undici:5555:27) at fullyReadBody (node:internal/deps/undici/undici:1665:9) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async specConsumeBody (node:internal/deps/undici/undici:5564:7) at async Module.POST (file:///var/task/vercel/path0/.vercel/output/_functions/chunks/route_Yu3iUWSv.mjs:17:12) at async renderEndpoint (file:///var/task/vercel/path0/.vercel/output/_functions/chunks/astro/server_CBvJsTK-.mjs:45:20) at async lastNext (file:///var/task/vercel/path0/.vercel/output/_functions/entry.mjs:1031:23) at async callMiddleware (file:///var/task/vercel/path0/.vercel/output/_functions/entry.mjs:480:10)