sidebase / nuxt-session

Nuxt session middleware to get a persistent session per app user, e.g., to store data across multiple requests. The nuxt session module provides the useSession() composable out of the box and sets up API endpoints to interact with your session to make working with sessions feel like a breeze.
https://sidebase.io/nuxt-session/
MIT License
189 stars 19 forks source link

First request creates diferent sessionId #77

Closed agracia-foticos closed 1 year ago

agracia-foticos commented 1 year ago

Environment

Reproduction

I cant create stackblitz environment with nuxt-session https://stackblitz.com/edit/nuxt-starter-xntdla

Describe the bug

When i use nuxt-session first, time with cookies / localStorage cleaned, i launch some route/api fetch.

In the Node part, the session dont shared between request, in any request the sessionId is created.

When first request is finished, created the sessionId cookie and runs ok.

FIRST REQUEST WITHOUT sessionIdCookie: image

NEXT REQUEST WITH sessionIDCookie: image

src/server/routes/fapi/[...].ts

export default defineEventHandler(async (event:H3Event) => { let session = event.context.session.id console.log('session', session)

Additional context

No response

Logs

No response

agracia-foticos commented 1 year ago

Solved in nuxt 3.5.2