Closed SheepTD closed 2 months ago
TL;DR workaround until we get this fixed: Pin supabase-js
to 2.43.5
(ie "@supabase/supabase-js": "2.43.5"
in your package.json
).
From a little bit of digging it seems this was introduced in https://github.com/supabase/postgrest-js/pull/540 on this line.
Interestingly if you change import index from '../cjs/index.js'
to import * as index from '../cjs/index.js'
, it works as expected.
cc @soedirgo I'm not too familiar with our ESM setup, would you mind taking a look and seeing if that is a viable fix? 🙏🏻
Thank you for finding this work around, you've saved me a lot of time and frustration. I'm afraid I don't know much at all about this or how to test the change your proposing, sorry. Good luck anyhow and thanks again.
I noticed the same. Raised a PR here: https://github.com/supabase/postgrest-js/pull/548
Bug report
Describe the bug
After strictly following the Build a User Management App with Expo React Native tutorial in the supabase docs and running the web version of the app I was faced with the following error message:
Uncaught TypeError: _index.default is undefined
in FirefoxUncaught TypeError: Cannot destructure property 'PostgrestClient' of '_index.default' as it is undefined.
in ChromeThis happened only with the web version. When I ran the app in Expo Go on Android it worked perfectly. I tried to debug the code and narrowed it down to single import statement
import { createClient } from "@supabase/supabase-js";
Only when this import statement is commented out does the error go away.
To Reproduce
npx expo install react-dom react-native-web @expo/metro-runtime
npm start
in the console and open the localhost url in your browser.If you want the app to load without the error, continue with the following:
const supabaseUrl = "..."; const supabaseAnonKey = "...";
// export const supabase = createClient(supabaseUrl, supabaseAnonKey, { // auth: { // storage: AsyncStorage, // autoRefreshToken: true, // persistSession: true, // detectSessionInUrl: false, // }, // });
export const supabase = "hello world";
export default function App() { const [session, setSession] = useState<Session | null>(null); // useEffect(() => { // supabase.auth.getSession().then(({ data: { session } }) => { // setSession(session); // }); // supabase.auth.onAuthStateChange((_event, session) => { // setSession(session); // }); // }, []); return (
); }