Open lucaskraus opened 1 month ago
same issue. I was downgrade to version 1.23.1 but it's still occur
I solve it by the following code.
import { AppState, Platform } from 'react-native';
import 'react-native-url-polyfill/auto';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { createClient } from '@supabase/supabase-js';
const supabaseUrl = process.env.EXPO_PUBLIC_SUPABASE_URL;
const supabaseAnonKey = process.env.EXPO_PUBLIC_SUPABASE_ANON_KEY;
if (!supabaseUrl || !supabaseAnonKey) {
throw new Error('Supabase URL or Anon Key is not defined');
}
class SupabaseStorage {
async getItem(key: string) {
if (Platform.OS === "web") {
if (typeof localStorage === "undefined") {
return null;
}
return localStorage.getItem(key);
}
return AsyncStorage.getItem(key);
}
async removeItem(key: string) {
if (Platform.OS === "web") {
return localStorage.removeItem(key);
}
return AsyncStorage.removeItem(key);
}
async setItem(key: string, value: string) {
if (Platform.OS === "web") {
return localStorage.setItem(key, value);
}
return AsyncStorage.setItem(key, value);
}
}
export const supabase = createClient(supabaseUrl, supabaseAnonKey, {
auth: {
storage: new SupabaseStorage(),
autoRefreshToken: true,
persistSession: true,
detectSessionInUrl: false,
},
});
ref issue: https://github.com/supabase/supabase-js/issues/786
What happened?
I'm trying to use the Web version of my project, but the bundle just stop to running immediately after complete the process with the following error in exit:
Version
2.0.0
What platforms are you seeing this issue on?
System Information
Steps to Reproduce