Skip to content

useSupabaseClient fails with auto-import and manual import in Nuxt 3 + @nuxtjs/supabase #33925

@tony-osama

Description

@tony-osama

Environment

Environment

  • Nuxt version: v4.2.2/
  • @nuxtjs/supabase: 2.x
  • Node version: v20.19.0
  • OS: Windows 10 / 11
  • Package manager: npm

Issue 1: useSupabaseClient is not available at runtime

Description

useSupabaseClient is not available at runtime and throws different errors depending on how it is accessed:

  • useSupabaseClient is not defined
  • (…) useSupabaseClient is not a function

This happens even when:

  • @nuxtjs/supabase is correctly installed
  • The module is registered in nuxt.config.ts
  • The dev server is restarted
  • .nuxt directory is removed

What I tried

  • Auto-import (no import statement)
  • Import from #imports
  • Import from #supabase
  • Import from @nuxtjs/supabase
  • Access via useNuxtApp()
  • Removing compatibilityDate
  • Full reinstall of dependencies

None of these approaches worked reliably.

Minimal reproduction

<script setup>
const supabase = useSupabaseClient()
</script>

Reproduction

Environment

  • Nuxt version: 3.x
  • @nuxtjs/supabase: 2.x
  • Node version: v20.19.0
  • OS: Windows 10 / 11
  • Package manager: npm

Issue 1: useSupabaseClient is not available at runtime

Description

useSupabaseClient is not available at runtime and throws different errors depending on how it is accessed:

  • useSupabaseClient is not defined
  • (…) useSupabaseClient is not a function

This happens even when:

  • @nuxtjs/supabase is correctly installed
  • The module is registered in nuxt.config.ts
  • The dev server is restarted
  • .nuxt directory is removed

What I tried

  • Auto-import (no import statement)
  • Import from #imports
  • Import from #supabase
  • Import from @nuxtjs/supabase
  • Access via useNuxtApp()
  • Removing compatibilityDate
  • Full reinstall of dependencies

None of these approaches worked reliably.

Minimal reproduction

<script setup>
const supabase = useSupabaseClient()
</script>


### Describe the bug

In a fresh Nuxt project, `useSupabaseClient` cannot be used reliably.

Calling `useSupabaseClient()` results in runtime errors such as:
- `useSupabaseClient is not defined`
- `useSupabaseClient is not a function`

This happens even in a minimal setup with:
- `@nuxtjs/supabase` installed
- Module registered in `nuxt.config.ts`
- No custom plugins or configuration

The behavior is inconsistent with the documentation and makes it unclear how developers are expected to access the Supabase client in Nuxt 3 / Nuxt 4.

This issue blocks basic authentication flows (e.g. signInWithOtp) and significantly impacts developer experience.


### Additional context

I can provide a minimal reproduction repository if needed.
The issue occurs in a fresh Nuxt project with only @nuxtjs/supabase installed.


### Logs

```shell-script

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions