You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running supabase locally with docker containers, the client seems to not fully initialize, leading to "hanging" of the application where no calls to supabase.authsupabase.from('users').select('count').limit(1); return at all.
I initialize the client like this:
import { createClient, SupabaseClient } from '@supabase/supabase-js'
import config from './config'
// Create a single supabase client for interacting with your database
const supabase: SupabaseClient = createClient(config.supabase.url, config.supabase.apiKey);
export default supabase;
then use it in other components, for example, like this:
function Landing() {
useEffect(() => {
try {
const { data, error } = await supabase
.from('users')
.select('*')
.eq('id', supabaseUser.id)
.single();
console.log('back from supabase call'); // THIS NEVER GETS HIT
if (error) throw error;
const extendedUser: ExtendedUser = {
...supabaseUser,
...data,
};
}, []);
return (
<div>
Landing page
</div>
)
}
However, calls to supabase.auth.onAuthStateChange... DOES work. For example, I have this in one of my components:
const { data: { subscription } } = auth.onAuthStateChange(async (event, session) => {
console.log('event:', event); // THIS DOES GET HIT
...
});
As a workaround, I put this line immediately after I create the supabase client:
import { createClient, SupabaseClient } from '@supabase/supabase-js'
import config from './config'
// Create a single supabase client for interacting with your database
const supabase: SupabaseClient = createClient(config.supabase.url, config.supabase.apiKey);
await supabase.from('users').select('count').limit(1);
export default supabase;
Then, all of the calls seems to work UNTIL the web page goes stale.
Has anyone seen this before? It seems to be something with the client lazy initialization?
It does not look like it is happening in my production environment, only running with the docker containers locally
To Reproduce
take minimal supabase project, docker containers and set up auth and query the db
Expected behavior
Should not need to make initial supabase db call for calls to work.
System information
OS: macOS
Browser any
Version of supabase-js: 2.45.0
Version of Node.js: 21.2.0
The text was updated successfully, but these errors were encountered:
Bug report
Describe the bug
When running supabase locally with docker containers, the client seems to not fully initialize, leading to "hanging" of the application where no calls to
supabase.auth
supabase.from('users').select('count').limit(1);
return at all.I initialize the client like this:
then use it in other components, for example, like this:
However, calls to
supabase.auth.onAuthStateChange...
DOES work. For example, I have this in one of my components:As a workaround, I put this line immediately after I create the supabase client:
Then, all of the calls seems to work UNTIL the web page goes stale.
Has anyone seen this before? It seems to be something with the client lazy initialization?
It does not look like it is happening in my production environment, only running with the docker containers locally
To Reproduce
take minimal supabase project, docker containers and set up auth and query the db
Expected behavior
Should not need to make initial supabase db call for calls to work.
System information
The text was updated successfully, but these errors were encountered: