Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'auth') #15

Open
g1ronn1mo opened this issue Jan 16, 2024 · 0 comments

Comments

@g1ronn1mo
Copy link

g1ronn1mo commented Jan 16, 2024

store/auth.ts

import { createClient } from '@supabase/supabase-js'

export const authStore = defineStore({
  id: 'main',
  state: () => ({
    supabaseClient: null,
  }),
  actions: {
    initialiseSupabase() {
      const supabaseUrl = process.env.SUPABASE_URL
      const supabaseKey = process.env.SUPABASE_KEY
      this.supabaseClient = createClient(supabaseUrl, supabaseKey)
    },
  },
})

Login.vue

<script setup lang="ts">
// Import predefined theme
import { ThemeSupa } from '@supabase/auth-ui-shared'
import { Auth } from '@nuxtbase/auth-ui-vue'
import { authStore } from '@/stores/auth'

const themeColor = useColorMode()

const store = authStore()
</script>

<template>
  <Auth
    :supabase-client="store.supabaseClient"
    :providers="[]"
    :appearance="{
      theme: ThemeSupa,
    }"
    :theme="themeColor.value"
    
  />
</template>

I have no idear why this should not work. But I get

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'auth')
    at f (@nuxtbase_auth-ui-vue.js?v=e511d63d:1418:38)
    at fn._withMods.fn._withMods (chunk-7SWADUAP.js?v=e511d63d:10764:12)
    at callWithErrorHandling (chunk-7SWADUAP.js?v=e511d63d:1593:18)
    at callWithAsyncErrorHandling (chunk-7SWADUAP.js?v=e511d63d:1601:17)
    at HTMLFormElement.invoker (chunk-7SWADUAP.js?v=e511d63d:9974:5)

In supabase I get a 200 request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant