undefined is not an object (evaluating 'globalThis.localStorage.getItem')] in react-native
Getting this error. I'm assuming this is something to do with localStorage.
relavant stackoverflow issue https://stackoverflow.com/questions/68763589/undefined-is-not-an-objectevaluating-this-localstorage-getitem-error-in-reac
can someone help me with this? I tried to clean localStorage too. didn't work.
Stack Overflow
undefined is not an object(evaluating 'this.localStorage.getItem') ...
I tried to implement supabase with react-native expo app. Then got this error when trying to call a GET API call to get all data from 'Players' table but got an error in localstorage. How to fix th...
13 Replies
https://supabase.com/docs/guides/with-expo#initialize-a-react-native-app I think you need a localStorage polyfill for react-native, but I don't use it.
Quickstart: Expo | Supabase
Learn how to use Supabase in your React Native App.
Yes, I did. here is my code -
but it is still throwing me same error. I'm assuming supabase is not giving me data.
@Team can anyone help me with this? Why supabase returning this error?
It is extremely bad form to flag all employees especially on a user to user forum.
The v1 guide showed
as any
with AsyncStorage. Don't know if that is your issue or not.
Also the code you have assumes you are using v1. v2 is now in the linked guide and has a slightly different set up.I'm sorry for that. won't happen again. I promise.
Also have you looked at any of these: from a google search on "undefined is not an object globalThis.localStorage.getItem supabase"
https://github.com/supabase/gotrue-js/issues/431
https://stackoverflow.com/questions/73601394/error-typeerror-undefined-is-not-an-object-evaluating-globalthis-localstorag
I'm sort of surprised on the 2nd one as I would not expect the message at that point in a call....
GitHub
supabase-js 2.0rc8: React native support · Issue #431 · supabase/go...
React native support for supabase-js v2 After installing supabase-js 2.0rc8, I get a bunch of errors in my react native (expo managed) project. Describe the bug Immediately after installing supabas...
Stack Overflow
ERROR [TypeError: undefined is not an object (evaluating 'globalThi...
I am trying to just select everything from a table from supabase. When I perform my fetch function, this is thrown and I dont know why.I have my URL and Key set into my supbase.js file.
picture of ...
Are you v1 or v2/rc?
This is my current code. Still facing same issue. Don't know why. Yes, I looked into those solutions but didn;t work
I'm on v2
"@supabase/supabase-js": "^2.0.0-rc.10",
as any
works in typescript. I'm suing JS. correct me if im wrongI believe that is correct... I don't use typescript or react-native though.
The only thing I notice different is your polyfill stuff is in a different place than the guide. But since I don't really know what is going on not sure that matters. Does the error occur during the createClient call?
No.. It's fine.. It's giving me error when I'm trying to fetch all data from my table.
Ahh... localStorage versus storage as the key?
yeah, I tried that too. didn't work.. lemme try it again 😃
WTF.. it worked... It didn't work before.. Thanks a lot and sorry for that
You may have not had auth before when you tried it?
yeah yeah, It might be. because I added this auth part recently.