#supabase error: Database error saving new user

16 messages · Page 1 of 1 (latest)

nocturne summit
#

idk if i can ask this here but, can someone tell me what i'm doing wrong? i'm trying to make a register page using supabase auth, but i always got the error on title. tried everything already but nothing seems to work D: here's my code:

definePageMeta({
  middleware: 'unauthenticated',
})

const isErrorVisible = ref(false)
const errorMessage = ref('')
const successMessage = ref('')

const supaAuth = useSupabaseAuthClient().auth;

const credentials = reactive({
  username: '',
  email: '',
  password: ''
})

const userRegister = async () => {
  const { error } = await supaAuth.signUp({
    email: credentials.email,
    password: credentials.password,
    options: {
      data: {
        username: credentials.username,
      }
    }
  })

  if (error) {
    errorMessage.value = error.message;
    isErrorVisible.value = true;
  } else {
    successMessage.value = 'check your email for confirmation.'
    return navigateTo('/')
  }
}

thanks if someone can help me!

nocturne summit
#

anyone?

pearl nacelle
#

What does the error say?

nocturne summit
nocturne summit
#

i really don't know what's wrong tbh.

nocturne summit
#

anyone?

pearl nacelle
#

Are you using the superbase nuxt module?

nocturne summit
#

@nuxtjs/supabase

pearl nacelle
#

Did you configure it properly?

nocturne summit
#

yes

#

followed all steps on website, searched for some repos on Github, the code is the same, .env is ok too

nocturne summit
#

uh

forest crater
#
  const user = useSupabaseUser()
  const client = useSupabaseAuthClient()
  const router = useRouter()

  const email = ref('')
  const password = ref('')

  const signUp = async () => {
    const { user, error } = await client.auth.signUp({
      email: email.value,
      password: password.value
    }) 
    router.push('/auth/lobby')
  }

This works for me, maybe try it?

nocturne summit
#

lemme try it, but, im using username to register the user too, not the email and pass only.

#

but i will try @forest crater