New Dec 24, 2025

Nuxt js 3 cookies not set in the hosted environment

Libraries, Frameworks, etc. All from Newest questions tagged vue.js - Stack Overflow View Nuxt js 3 cookies not set in the hosted environment on stackoverflow.com

I have this Nuxt 3 end point

// server/api/login.post.ts
export default defineEventHandler((event) => {
  const token = "set by login api";
  // Delete all cookies
  const cookies = parseCookies(event);
  for (const cookieName in cookies) {
    deleteCookie(event, cookieName);
  }

setCookie(event, "pathumToken", token, { httpOnly: true, secure: true, sameSite: "none", path: "/", }); const tokenResults = getCookie(event, "pathumToken");

// biome-ignore lint/suspicious/noConsole: <explanation> console.log("Set Cookie =", tokenResults);

return { token: tokenResults, }; });

Which works fine in the local and returns the outpput correctly which is

{
    "token": "set by login api"
}

But the same endpoint not working in the hosted environment. It won't return an error either it will return this

{}

What are the possible reasons that this could happen?

Scroll to top