I have created a React Native CLI app project in TypeScript with Supabase integration. I’ve set up my client like this:
import { createClient } from '@supabase/supabase-js';
export const supabase = createClient(supabaseUrl, supabaseKey);
then, I’m trying to fetch all rows from my user table using try/catch:
try {
const { data, error } = await supabase.from('user').select();
if (error) {
console.log(error.message);
}
console.log(data);
} catch {
console.log('Error');
}
However, when I run it with react-native run-android, I get this error:
TypeError: Cannot assign to property 'protocol' which has only a getter, js engine: hermes, stack: SupabaseClient@98161:32 createClient@98094:39 anonymous@97974:109 loadModuleImplementation@267:13 guardedLoadModule@175:37 metroRequire@89:91 anonymous@97935:50 loadModuleImplementation@267:13 guardedLoadModule@175:37 metroRequire@89:91 anonymous@1279:47 loadModuleImplementation@267:13 guardedLoadModule@168:46 metroRequire@89:91 global@109438:3
Has anyone run into this issue or know what might be causing it?
Additional notes:
- I previously tested with
@supabase/[email protected]and it worked fine; I’ve now upgraded to@supabase/[email protected]. - I’ve also run this same Supabase query in a React CRA project, and it successfully logs the user table data to the console.
- This React Native CLI app will eventually be part of a PNPM monorepo, so there may be some extra dependency-resolution or linking considerations.
package.json:
{
"dependencies": {
"@react-native/new-app-screen": "0.80.0",
"@supabase/supabase-js": "^2.50.2",
"react": "19.1.0",
"react-native": "0.80.0",
"react-native-blob-util": "^0.22.2",
"react-native-crypto": "^2.2.1"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native-community/cli": "19.0.0",
"@react-native-community/cli-platform-android": "19.0.0",
"@react-native-community/cli-platform-ios": "19.0.0",
"@react-native/babel-preset": "0.80.0",
"@react-native/eslint-config": "0.80.0",
"@react-native/metro-config": "0.80.0",
"@react-native/typescript-config": "0.80.0",
"@types/jest": "^29.5.13",
"@types/react": "^19.1.0",
"@types/react-test-renderer": "^19.1.0",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "19.1.0",
"typescript": "5.0.4"
},
"engines": {
"node": ">=18"
}
}