supabase: No storage option exists to persist the session, which may result in unexpected behavior when using auth.

seeing this warning/information on starting the dev server. Not sure of the implications and what action needs to be taken. FYI - discussion thread on Supabase - Discord server

No storage option exists to persist the session, which may result in unexpected behavior when using auth. If you want to set persistSession to true, please provide a storage option or you may set persistSession to false to disable this warning.

my nuxi info-

- Operating System: Darwin
- Node Version:     v19.8.1
- Nuxt Version:     3.5.2
- Nitro Version:    2.4.1
- Package Manager:  npm@9.5.1
- Builder:          vite
- User Config:      typescript, colorMode, app, plugins, modules, googleFonts, routeRules, runtimeConfig, nitro, devtools, image, vite
- Runtime Modules:  @storyblok/nuxt@5.4.7, @nuxt/image-edge@1.0.0-28092818.5c21f4c, @nuxt/devtools@0.5.5, @nuxtjs/supabase@0.3.5, @nuxtjs/google-fonts@3.0.1, @formkit/nuxt@0.17.2, @nuxthq/ui@2.2.1, @pinia/nuxt@0.4.11, @pinia-plugin-persistedstate/nuxt@1.1.1, @vee-validate/nuxt@4.9.6
- Build Modules:    -

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 10
  • Comments: 27 (1 by maintainers)

Most upvoted comments

const supabase = createClient<Database>( process.env.NEXT_PUBLIC_SUPABASE_URL as string, process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY as string, { auth: { persistSession: false } } );

hi im from the future :3

This warning is coming from the “@supabase/supabase-js” package. Because the “persistSession” is not set. For more information: https://supabase.com/docs/reference/javascript/release-notes

Add to your nuxt.config.ts the following:

supabase: {
  client: {
      auth: {
          persistSession: false //or true
      }
  }
}

After this change the warning is gone.

@maximilian-schwarz what are the implications of setting persistSession to true or false? What was the default behaviour before?

I’m still getting this error despite putting the code in my nuxt.config.js.


  • Operating System: Darwin
  • Node Version: v18.16.0
  • Nuxt Version: 3.6.2
  • Nitro Version: 2.5.2
  • Package Manager: yarn@1.22.10
  • Builder: vite
  • User Config: app, runtimeConfig, components, css, plugins, buildModules, modules, colorMode, supabase, target, build
  • Runtime Modules: @nuxtjs/tailwindcss@6.8.0, @nuxtjs/color-mode@3.3.0, @vueuse/nuxt@10.2.1
  • Build Modules: -

Can anyone explain what persistSession does? In which case does it persist the session? Whats better for me, true or false?

How this helps:

{
   global: { headers: { Authorization: req.headers.get("Authorization")! } },
   auth: {
    detectSessionInUrl: false,
    autoRefreshToken: false,
    persistSession: false,
   }
}

@louis030195 based on what I see in your code, you’re running the client on the server-side. And since you’re not using auth helpers here, or custom storage, you should be setting these three auth options for your client.

const options = {
  auth: {
    persistSession: false,
    autoRefreshToken: false,
    detectSessionInUrl: false
  }
}

Looks like this was resolved in release 0.3.6

Or maybe i’m wrong im still testing this, damn so confusing

Basically in Next.js using client component in useEffect i’m calling await db.auth.getSession() and i get this error message, but only get this once after i started dev server, when doing refresh i dont get this printed anymore, but if i kill and start again then i get

No storage option exists to persist the session, which may result in unexpected behavior when using auth.
        If you want to set persistSession to true, please provide a storage option or you may set persistSession to false to disable this warning.

same problem on latest version: 0.3.6

Screenshot 2023-06-03 at 12 42 38



@tidusvn05 can you try 0.3.7? Someone found another portion of code which needed changed.

resolved in release 0.3.6.