I am using react-native with expo and trying to connect supabase. This is my code:
lib/supabase.ts
import 'react-native-url-polyfill/auto'
import * as SecureStore from 'expo-secure-store'
import { createClient } from '@supabase/supabase-js'
const ExpoSecureStoreAdapter = {
getItem: (key: string) => {
return SecureStore.getItemAsync(key)
},
setItem: (key: string, value: string) => {
SecureStore.setItemAsync(key, value)
},
removeItem: (key: string) => {
SecureStore.deleteItemAsync(key)
},
}
const supabaseUrl = String(process.env.SUPABASE_URL)
const supabaseAnonKey = String(process.env.SUPABASE_KEY)
export const supabase = createClient(supabaseUrl, supabaseAnonKey, {
auth: {
storage: ExpoSecureStoreAdapter as any,
autoRefreshToken: true,
persistSession: true,
detectSessionInUrl: false
},
})
This is exactly what supabase provides
I dont know why i am getting this errors I have tried clearing the cache reinstalling node modules I have checked that I am using the correct Keys.
I had forgotten to set up dotenv for react-native.