Good evening all - I'm trying to use Supabase with...
# help
s
Good evening all - I'm trying to use Supabase with Nuxt and I'm experiencing a weird error. I'm using the Nuxt
fetch
hook to retrieve data (my app is using SSR) and when I first navigate to a page I call
this.$supabase.auth.user()
from
fetch
and get the user info back but if I refresh the browser
null
is then returned, which is causing me a real headache... I can see the user info still in localStorage but I'm not sure why the call to get the user info fails after a reload?
Specifically I'm seeing this error on page reload
Error in fetch(): TypeError: Cannot destructure property 'id' of 'this.$supabase.auth.user(...)' as it is null.
Ok this may not be a supabase issue since if I refresh another page that also uses the Nuxt
fetch
hook I get the error
Error in fetch(): ReferenceError: $nuxt is not defined
m
Are you using nuxt3?
s
No I’m using Nuxt 2 because Nuxt 3 is still in beta
It seems like for some reason when a page refresh happens the data isn’t refetched which is weird…