Skip to content

updateSession sets an empty cookie #2316

@shinobijs

Description

@shinobijs

Checklist

Description

When calling auth0.updateSession(req, res, session) in a Page router endpoint, response header set-cookie is empty. And the session is never updated on the client.

'set-cookie': [ 'appSession=; Path=/; Max-Age=0' ]

Reproduction

In a Page API route add the following code.

let session = await auth0.getSession(req);
session.user.username = "younameit";
await auth0.updateSession(req, res, session);
console.log(res.getHeaders());

Additional context

No response

nextjs-auth0 version

4.9.0

Next.js version

15.5.2

Node.js version

20.18.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions