Skip to content

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

@g1ronn1mo

Description

@g1ronn1mo

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions