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

`ERR_HTTP_HEADERS_SENT` #35

Open IronicUsername opened 1 year ago

IronicUsername commented 1 year ago

Environment

Reproduction

Set the ipPinning to true here and either

both actions where performed on the playground.

Describe the bug

As it seems like, there is a bug in resetting a session when the IP is pinned. There should be some way of error handling when it comes to the above described case.

Additional context

No response

Logs

[nitro] [dev] [unhandledRejection] Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
    at new NodeError (node:internal/errors:371:5)
    at ServerResponse.setHeader (node:_http_outgoing:576:11)
    at appendResponseHeader (file:///Users/IronicUsername/Development/personal/nuxt-session/node_modules/h3/dist/index.mjs:280:13)
    at setCookie (file:///Users/IronicUsername/Development/personal/nuxt-session/node_modules/h3/dist/index.mjs:341:3)
    at deleteCookie (file:///Users/IronicUsername/Development/personal/nuxt-session/node_modules/h3/dist/index.mjs:344:3)
    at deleteSession (file:///Users/IronicUsername/Development/personal/nuxt-session/playground/.nuxt/dev/index.mjs:543:3)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async getSession (file:///Users/IronicUsername/Development/personal/nuxt-session/playground/.nuxt/dev/index.mjs:579:5)
    at async ServerResponse.<anonymous> (file:///Users/IronicUsername/Development/personal/nuxt-session/playground/.nuxt/dev/index.mjs:599:21) {
  code: 'ERR_HTTP_HEADERS_SENT'
}