Closed ThibaultJanBeyer closed 7 months ago
Nevermind, it seems to be a bug in the async storage not being compatible with the web. import AsyncStorage from "@react-native-async-storage/async-storage";
So adding ...(Platform.OS !== "web" ? { storage: AsyncStorage } : {}),
in the createClient
solves the issue:
export const supabase = createClient(supabaseUrl, supabaseAnonKey, {
auth: {
...(Platform.OS !== "web" ? { storage: AsyncStorage } : {}),
autoRefreshToken: true,
persistSession: true,
detectSessionInUrl: false,
},
});
Closed. Sorry.
Your solution worked great for me, thanks :)
Nevermind, it seems to be a bug in the async storage not being compatible with the web.
import AsyncStorage from "@react-native-async-storage/async-storage";
So adding
...(Platform.OS !== "web" ? { storage: AsyncStorage } : {}),
in thecreateClient
solves the issue:export const supabase = createClient(supabaseUrl, supabaseAnonKey, { auth: { ...(Platform.OS !== "web" ? { storage: AsyncStorage } : {}), autoRefreshToken: true, persistSession: true, detectSessionInUrl: false, }, });
Closed. Sorry.
it is saying the platform is not defined. what I have to do for that.
Nevermind, it seems to be a bug in the async storage not being compatible with the web.
import AsyncStorage from "@react-native-async-storage/async-storage";
So adding...(Platform.OS !== "web" ? { storage: AsyncStorage } : {}),
in thecreateClient
solves the issue:export const supabase = createClient(supabaseUrl, supabaseAnonKey, { auth: { ...(Platform.OS !== "web" ? { storage: AsyncStorage } : {}), autoRefreshToken: true, persistSession: true, detectSessionInUrl: false, }, });
Closed. Sorry.
it is saying the platform is not defined. what I have to do for that.
A bit late, but you need to import Platform from react native :
import { Platform } from 'react-native';
Bug report
Hi, following this tutorial, I try to run supabase js client in expo and this crashes the app on web:
gives me:
When running the web application on Chrome. It does work in the Android native app tho’
Thank you!