The supabase.auth.signOut() method fails to return or throw errors when signing out a valid user session. It still signs out the user but this only is reflected when the user manually reloads the page. This was addressed in https://github.com/supabase/auth-js/issues/345 but the suggested method useSupabaseAuthClient(); appears to be deprecated.
To Reproduce
The following vue component is rendered on /signout the user is directed to this page when they click a singout button in the nav bar. No error is thrown and nothing is logged when this page renders. No other links in the nav bar that use router.push work either so I believe this is cause by await supabase.auth.signOut(); not returning. I've resorted to just having a manual link back to the home page of my application.
In my project I'm using pinia to handle the supabase client but I'm exuding that from this example for simplicity, the behavior is identical to my example.
SignOutPageView.vue:
<script setup>
import { onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { createClient } from "@supabase/supabase-js";
const router = useRouter();
const supabase = createClient(supabaseUrl, supabaseKey); // replace with valid credentials
const signOut = async () => {
try {
const { error } = await supabase.auth.signOut();
if (error) throw error;
console.log('Signed out successfully');
} catch (error) {
console.error('Error signing out:', error.message);
} finally {
router.push('/');
}
};
onMounted(() => {
signOut();
});
</script>
<template>
<h1>Signing you out...</h1>
<p>
If you are still not redirected after 5 seconds click this
link to return to home page <a href="/">https://example.com</a>
</p>
</template>
Expected behavior
supabase.auth.signOut(); should return an error or complete its process allowing the rest of the code to continue.
Bug report
Describe the bug
The
supabase.auth.signOut()
method fails to return or throw errors when signing out a valid user session. It still signs out the user but this only is reflected when the user manually reloads the page. This was addressed in https://github.com/supabase/auth-js/issues/345 but the suggested methoduseSupabaseAuthClient();
appears to be deprecated.To Reproduce
The following vue component is rendered on
/signout
the user is directed to this page when they click a singout button in the nav bar. No error is thrown and nothing is logged when this page renders. No other links in the nav bar that userouter.push
work either so I believe this is cause byawait supabase.auth.signOut();
not returning. I've resorted to just having a manual link back to the home page of my application.In my project I'm using pinia to handle the supabase client but I'm exuding that from this example for simplicity, the behavior is identical to my example.
SignOutPageView.vue
:Expected behavior
supabase.auth.signOut();
should return an error or complete its process allowing the rest of the code to continue.System information
Additional context
Recent discord thread about this: https://discord.com/channels/839993398554656828/1260740210178654249