Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auth.signOut() method fails to return or throw errors, leading to UI hangs #936

Open
2 tasks done
NotJoeMartinez opened this issue Aug 2, 2024 · 0 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@NotJoeMartinez
Copy link

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

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 #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.

System information

  • OS: [macOS]
  • Browser [chrome, firefox, safari]
  • Version of supabase-js: [2.64.2]

Additional context

Recent discord thread about this: https://discord.com/channels/839993398554656828/1260740210178654249

@NotJoeMartinez NotJoeMartinez added the bug Something isn't working label Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant