This content originally appeared on DEV Community and was authored by Cojiroooo
Problem
I write the below, but it doesn't occur any errors and the process terminated prematurely.
At the first time after the server started, that was successful, but that happen after the reload browser.
supabase.auth.onAuthStateChange(async (event, session) => {
// ...
const { data, error } = await supabase.from("table_name").select(); // the process finished
// ...
});
Causes
I found the answer to this problem in the document.
Do not use other Supabase functions in the callback function. If you must, dispatch the functions once the callback has finished executing. Use this as a quick way to achieve this:
https://supabase.com/docs/reference/javascript/auth-onauthstatechange
Solution
I wanted to fetch the user information when users authentication was successful.
const afterSignedIn = async () => {
const { data, error } = await supabase.from("users").select();
};
supabase.auth.onAuthStateChange(async (event, session) => {
// ...
setTimeout(() => {
afterSignedIn();
}, 0);
});
This content originally appeared on DEV Community and was authored by Cojiroooo

Cojiroooo | Sciencx (2024-09-10T03:01:03+00:00) supabase.from().select() finished unexpectedly and doesn’t occur any errors. Retrieved from https://www.scien.cx/2024/09/10/supabase-from-select-finished-unexpectedly-and-doesnt-occur-any-errors/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.