Uncaught TypeError supabase.auth.user is not a function

I'm trying to figure out what I've done wrong here, and have been unsuccessful thus far. The error i'm getting is "Uncaught TypeError supabase.auth.user is not a function". The issue is at line 18 in my App.vue file (I'm using Vue 3). On that line is
const user = supabase.auth.user();
const user = supabase.auth.user();
(as shown in code pictured). I'm not sure what I'm missing or did wrong.
11 Replies
garyaustin
garyaustin3y ago
You likely are using supabase-js v2. .user is no longer the name of the function.
ChunkyLubie
ChunkyLubieOP3y ago
@garyaustin Okay. I'm just going off what current docs say
ChunkyLubie
ChunkyLubieOP3y ago
See under "User" section
garyaustin
garyaustin3y ago
Looks like they missed that line in the API section of the UI. I notice the other ones (the varius sign ins) are v2. Probably needs to be flagged as an issue in supabase/supabase github.
ChunkyLubie
ChunkyLubieOP3y ago
I will do so. Appreciate the help! Switching .user to .getUser resolved it
ChunkyLubie
ChunkyLubieOP3y ago
@garyaustin Well, I have that part, however, once I log out, I get this error, and I have no clue what to do to resolve this.
No description
ChunkyLubie
ChunkyLubieOP3y ago
This is the error it is giving me at that URL: {"message":"No API key found in request","hint":"No apikey request header or url param was found."}
garyaustin
garyaustin3y ago
You will probably want to ask a new question. Normally you use getSession in v2 and the user object from that for detecting a signin in progress. When you logout getUser will fail I assume since you no long have a session.
ChunkyLubie
ChunkyLubieOP3y ago
Okay.

Did you find this page helpful?