1

I have a project created with Vite that uses Nuxt.

Within the script, I want to use useSupabaseClient(), but I'm getting an "is not defined" error.

The dependency @nuxtjs/supabase is installed and up to date. I believe the issue is in the import, but the module is already imported in nuxt.config.js.

Auth.vue

<script setup>
  const client = useSupabaseClient()
  const user = useSupabaseUser()

  const login = async (prov) => {
    const { data, error } = await client.auth.signInWithOAuth({
      provider: prov,
    })
    console.log(data, error)
  }
</script>

Nuxt.config.js

export default defineNuxtConfig({
  pages: true,
  modules: [
      'nuxt-icon',
      'nuxt-lodash',
      '@pinia/nuxt',
      '@pinia-plugin-persistedstate/nuxt',
      '@nuxtjs/tailwindcss',
      '@nuxtjs/supabase'
  ],
}
  • You should provide the exact error you are getting and also state where you are using the `useSupabaseClient`, is it in a page, layout or component? – Andrew Smith Aug 14 '23 at 21:33

0 Answers0