supabase-js: (Supabase.js not working with expo sdk 53 ? ) The package at "node_modules\ws\lib\stream.js" attempted to import the Node standard library module "stream".
Supabase not working with expo sdk 53 ?
I updated from latest expo sdk 52.0.46 to new expo sdk 53.0.1 , i am also using node 23.11.0 , and i am using eas build . System windows 11.0.0
Everything worked perfectly on expo sdk 52.0.46 with custom dev client and now getting this error
============ error ==========
Android Bundling failed 23470ms index.js (2841 modules) The package at “node_modules\ws\lib\stream.js” attempted to import the Node standard library module “stream”. It failed because the native React runtime does not include the Node standard library. Learn more: https://docs.expo.dev/workflow/using-libraries/#using-third-party-libraries
below is my package json with the scripts :
{
"private": true,
"name":NoMoneyNoHoney",
"version": "1.0.0",
"scripts": {
"eas-android-development-client-apk": "eas build -p android --profile development",
"eas-android-development-client-apk-local": "eas build --profile development --platform android --local",
"android": "expo run:android",
"ios": "expo run:ios",
"publish": "expo publish",
"expo-doctor": "npx expo-doctor@latest",
"-": "-",
"deploy": "eas build --platform android",
"check-updates": "npx npm-check-updates",
"upgrade-dependencies": "npx expo install --fix",
"--": "--",
"eas-android-production-apk": "eas build -p android --profile production-apk",
"eas-android-local-prod-apk": "eas build --profile production-apk --platform android --local",
"---": "---",
"npx_prebuild": "npx expo prebuild --clean",
"start": "npx expo start --dev-client",
"clearCache": "npx expo start -c"
},
"dependencies": {
"@expo/metro-config": "~0.20.0",
"@expo/metro-runtime": "~5.0.4",
"@expo/prebuild-config": "~9.0.0",
"@expo/vector-icons": "^14.1.0",
"@notifee/react-native": "9.1.8",
"@react-native-async-storage/async-storage": "2.1.2",
"@react-native-community/netinfo": "11.4.1",
"@sentry/react-native": "~6.10.0",
"@shopify/react-native-skia": "v2.0.0-next.2",
"@supabase/supabase-js": "2.49.4",
"@types/react": "~19.0.10",
"axios": "1.9.0",
"expo": "~53.0.1",
"expo-application": "~6.1.3",
"expo-asset": "~11.1.3",
"expo-auth-session": "~6.1.4",
"expo-av": "~15.1.3",
"expo-build-properties": "~0.14.5",
"expo-clipboard": "~7.1.3",
"expo-constants": "~17.1.3",
"expo-crypto": "~14.1.3",
"expo-dev-client": "~5.1.5",
"expo-device": "~7.1.3",
"expo-document-picker": "~13.1.4",
"expo-file-system": "~18.1.7",
"expo-image-picker": "~16.1.3",
"expo-linear-gradient": "~14.1.3",
"expo-linking": "~7.1.3",
"expo-sharing": "~13.1.4",
"expo-splash-screen": "~0.30.6",
"expo-system-ui": "~5.0.5",
"expo-web-browser": "~14.1.5",
"firebase": "11.6.1",
"lottie-react-native": "7.2.2",
"qs": "6.14.0",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-native": "0.79.1",
"react-native-animatable": "1.4.0",
"react-native-crypto-js": "^1.0.0",
"react-native-gesture-handler": "~2.24.0",
"react-native-google-mobile-ads": "14.11.0",
"react-native-reanimated": "~3.17.4",
"react-native-redash": "^18.1.3",
"react-native-safe-area-context": "5.3.0",
"react-native-screens": "~4.10.0",
"react-native-svg": "15.11.2",
"react-native-url-polyfill": "^2.0.0",
"react-native-view-shot": "~4.0.3",
"react-native-web": "^0.20.0",
"react-native-webview": "13.13.5",
"typescript": "~5.8.3",
"zustand": "^5.0.3"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"babel-plugin-module-resolver": "^5.0.2",
"prettier": "^3.5.3"
},
"expo": {
"doctor": {
"reactNativeDirectoryCheck": {
"listUnknownPackages": false
}
}
}
}
So i have builded succesfully a dev-client-apk and i pressed start project and i am getting this weird error and i searched everywhere and i don’t know if it’s supabase or expo having this issue right now :
It happens just when the app is building and ready to start … ============ error ==========
Android Bundling failed 23470ms index.js (2841 modules) The package at “node_modules\ws\lib\stream.js” attempted to import the Node standard library module “stream”. It failed because the native React runtime does not include the Node standard library. Learn more: https://docs.expo.dev/workflow/using-libraries/#using-third-party-libraries
============================
I did the below to check who is the guilty and maybe it’s supabase ?
npm ls ws
+-- @supabase/supabase-js@2.49.4
| `-- @supabase/realtime-js@2.11.2
| `-- ws@8.18.1
+-- expo@53.0.1
| `-- @expo/cli@0.24.7
| +-- @react-native/dev-middleware@0.79.1
| | `-- ws@6.2.3
| `-- ws@8.18.1 deduped
`-- react-native@0.79.1
+-- @react-native/community-cli-plugin@0.79.1
| `-- metro@0.82.2
| `-- ws@7.5.10
+-- react-devtools-core@6.1.1
| `-- ws@7.5.10
`-- ws@6.2.3
I searched for a workaround and tried with polyfill but nothing works … :
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 66
- Comments: 146 (22 by maintainers)
hi there! this is the same issue as https://github.com/supabase/realtime-js/issues/415
the teams at expo and supabase have been discussing this and a fix is in progress. you can disable the package exports configuration in metro as described here:
Hey everyone, we’re working on a fix for this, thanks for your patience!
when are you planning to fix this? should I change Supabase to Firebase as I’m starting a new project?
✅ It worked for me with your fix - Issue Resolved with Next Version of Supabase JS
If you’re experiencing issues related to stream or unsupported Node modules in Expo (e.g., with supabase-js in React Native or Expo projects), this has been addressed in the next release: @supabase/supabase-js@2.49.5-next.1 @supabase/realtime-js@2.11.8-next.1
📦 Install the fixed version directly: npm install @supabase/supabase-js@2.49.5-next.1 Tested and confirmed working with Expo SDK 53 and React Native 0.79+.
Thanks to the Supabase team for the quick patch! 🚀
i cant believe how much time i wasted trying to fix this only to find out its a supabase issue. I’m moving my app to firebase
New version now available, please do provide feedback so we can close this issue if fixed.
Version is 2.49.6
Thank you for the patience and for helping us.
@noberas - i hate to break it to you…
the firebase js package is also not working properly with react native 0.79 yet. you can change the metro bundler configuration to work around the issue for now: https://github.com/expo/expo/discussions/36551
To add to @filipecabaco, the fix for this issue is released in
@supabase/supabase-js@2.49.5-next.1! You can install this exact version and see if this resolves the issue for you.I’m glad to hear there’s progress. It’s been two days now that I’ve been waiting for the bug to be resolved. The project I’m working on is already well advanced and heavily relies on Supabase, which is deeply integrated into the architecture. While migrating to another service is technically possible, it would require a significant time investment—something that’s unfortunately not feasible given the tight delivery deadlines.
Not sure how much this will help, but I had Claude 4 craft a comment for you all based on our troubleshooting and discovered workaround for this issue. I don’t have the time myself to dig into the specifics, but hope that it might provide some insight for others looking into or dealing with this issue 😃
✅ Comprehensive Workaround for Expo SDK 53 + Supabase Compatibility
I wanted to share a complete solution that successfully resolves both the bundling issues and subsequent runtime authentication problems. This workaround was discovered and implemented with assistance from an AI agent (Claude 4 Sonnet) while debugging a production mobile app.
Metro Configuration Solution
The key is using Metro’s
resolveRequestmethod to intercept problematic Node.js module imports:Simplified Polyfills
Importantly, we found that removing conflicting polyfills was crucial. Many polyfills were actually making the problem worse:
❌ Avoid these polyfills that can cause the “blobId” runtime errors:
react-native-polyfill-globals/src/fetchreact-native-polyfill-globals/src/cryptoSupabase Client Configuration
Use a minimal Supabase client configuration:
Session Management for “missing sub claim” Errors
Handle corrupted sessions gracefully:
Results
✅ Bundle builds successfully (no more “node_modules/ws/lib/stream.js” errors)
✅ Authentication works properly (no “blobId” errors)
✅ Session management is stable (no “missing sub claim” spam)
✅ App runs reliably on iOS simulator and physical devices
Key Insights
resolveRequest> alias mapping: TheresolveRequestapproach is more reliable than Metro alias configurationsTested Environment
This solution addresses both the immediate bundling problem and the downstream runtime authentication issues that many developers encounter after “fixing” just the Metro configuration.
Hope this helps others experiencing this compatibility issue! 🚀
This workaround worked for me
-add a new file at project root
metro.config.jsand put this in it:-delete node_modules, -uninstall expo cli using
npm uninstall -g expo-clirun command
npm installto reinstallrun command
npx expo start --clearto start it back upThis fix worked for me I hope it works for somebody else.
Adding the false flag to my config works for now:
Hi all, we just released a fix for this in the latest https://github.com/supabase/supabase-js/releases/tag/v2.49.9
Please update, and let me know if it worked for your case.
Thanks.
Ok created a new version that should cover all versions. Would be really useful to get some help testing version 2.49.9-next.1
Here’s an image with a expo project; node testing; browser testing
we’re releasing a next version of supabase-js to try and test out if a fix works: https://github.com/supabase/supabase-js/pull/1395
Do I still need the workaround with the metro.config.js or the v2.50.0 solves everything?
Be aware that this is not the final version as my testing found some realtime-js issues but I will focus on fixing them so we can ship this ASAP.
Sorry for the delay and know that we are already working on our side to improve our testing methodology so we prevent issues like this in the future by testing multiple runtimes, bundlers, etc.
just wanna thank you @brentvatne for all of the work you do to keep the community moving. Your work directly correlates to the amount of hair I have left in my head because i’m not pulling it out 🙃.
Hi there, is there any solution for this? I am getting the same error and haven’t got a fix by now
this next version will be bumped to a patch release (2.49.5) this week as there are no breaking changes and only additive changes and fixes
Yes it has been solved in
2.49.5-next.5we are just doing due diligence of testing it in multiple scenarios and giving enough time for feedback.2.49.5itself, with the fix, will be released next week.awesome! I’m still trying to finalise some issues where some timers see to not be stopped at the correct time which might also be impacting operations but this means that we are close to actually release the fix properly
@EmilioMirasola thank you for verifying 🙏
@writeriks yes currently trying to fix this 🤦 I added a regression so I’m trying to focus on fixing that so I can release the proper patch
THIS WORKED PERFECTLY! Thank you
@jessewindebank1809 when I add this line to my metro.config.js file and restart the app the app crashes. This is what my current metro.config.js file looks like.
This is what npm ls ws shows
Hello Supabase team. Please urgently fix this issue. Because due to this issue my whole app is breaking. I was not facing this issue in Expo SDK 51 but when i migrated my codebase to latest Expo SDK 53 this issue keeps on popping. And as supabase is my backend. So my app is not functional at all. Please supabase team if you are reading this, then fix this issue ASAP.
Thank you Prince
The issue is still there I tried to downgrade the expo version but If I downgrade the expo app and simulator doesn’t want to run the app so we are cooked chat.
please can you help me do you have a contact please??
it doesn’t work 😦 still same error even after rebuilding eas local development build and cleaning the cache etc etc :
@brentvatne
I am going back to expo sdk 52.0.46 😦 sad sad 😦
My metro config
Hi all, since we had to rollback the release, this fix is currently only on
2.49.5-next.5, to summarize:2.49.5-next.5: expo compatibility fix2.49.52.49.6:works on expo, but broke browser, so we had to revert it2.49.7: same as2.49.5If your project is Expo, use
2.49.5-next.5, otherwise, use latest stable version,2.49.7.Thanks.
Upgrading to
@supabase/supabase-js": "^2.49.5-next.4worked for methis works for me#edited This thing works
I upgraded to v2.49.9 and confirm it’s working now.
Thank you for the fix! I’ve updated to supabase-js v2.49.9 and can confirm it’s working correctly.
This case worked for me, I recommend you test it.
I’m using the latest compatible version of the @supabase/supabase-js package with Expo SDK 53, but I’m still getting this error.
I was having the same issue and adding the metro.config was not working on my project… so I decided to start a new project and transferred all my files from my original project to the new one, and that, along with a metro.config.js file, worked well…I have no idea why it worked on a new project, but not the old one, but it did… Also, if you’re using any imports from rneui/themed, remove them
A fix for this is expected by?
@blukasik77 If you are testing with an iOS simulator, check if the simulator is running 18.4. Simulators running this version have a bug. You can fix this (for now) by testing on iOS 18.3.1. That solved the ‘network request failed’ errors for me. Apparantly a fix for the simulator is underway and ‘working’ on beta versions of XCode.
Best to also use the
config.resolver.unstable_enablePackageExports = false;fix just to be sureThis works for me, I am using react native CLI and not expo
This likely works as long as you don’t subscribe to any Realtime channels in the code — for example, using
supabase.auth.onAuthStateChange. As soon as a Realtime feature is used, the React Native runtime (with Expo 53) conflicts with Node.js dependencies likewsorhttps, causing the app to crash.This workaround worked for me! Will use this until the fix supabase and expo are working on is released. Thanks.
Thank you. I have disabled the unstable_enablePackageExports which worked for me.
Yeah I’m getting the same thing on my end. Happens on start up usually and I can’t call rpc either since it always goes to network errors.
I’ve been testing this out and seeing something peculiar on 2.49.9-next.1. Curious if others are running into issues where network calls are either failing or never load. No issues prior to this on Expo 52.
Edit: For more information, if i do a fresh
yarn iosto get a new build on my simulator, it will work okay for a little while. But after some hot reloads it starts to fail all network requests.Edit2: Some logs, though not super helpful (to me):
Supabase RPC response received {"dataLength": 0, "errorCode": "", "errorDetails": "TypeError: Network request failed at anonymous (http://192.168.0.157:8081/node_modules/expo-router/entry.bundle//&platform=ios&dev=true&hot=false&lazy=true&transform.engine=hermes&transform.bytecode=1&transform.routerRoot=app&unstable_transformProfile=hermes-stable:9642:33)", "errorHint": "", "errorMessage": "TypeError: Network request failed", "hasData": false, "hasError": true}This is the thing I hate most about expo, they force you to always update to the latest version, and after you update you get showered with bugs from different libraries that haven’t configured the update yet, which will never make your app production ready. Really considering not using expo anymore…
Compiles for me on an expo 53.0.9 app. Not using any streaming features though but it broke the build before
Yeah bump your deps up to:
npm install @supabase/supabase-js@2.49.5-next.5fixes the following Expo issue:
iOS Bundling failed 11751ms node_modules\expo-router\entry.js (1652 modules) The package at “node_modules\ws\lib\stream.js” attempted to import the Node standard library module “stream”.
Thank god for @grdsdev
Do you still need this in the metro config?
config.resolver.unstable_enablePackageExports = false;My code returns to the stream error when I remove it
Add Bellow codes in your project root
// metro.config.js const { getDefaultConfig } = require(‘expo/metro-config’);
/** @type {import(‘expo/metro-config’).MetroConfig} */ const config = getDefaultConfig(__dirname);
config.resolver.unstable_enablePackageExports = false;
module.exports = config;
@EricBidopa next.1 isn’t good enough.
do
npm install @supabase/supabase-js@2.49.5-next.5
Alright. Please comment here when it is released so i get the notification. A lot of people can’t use the expo go app on iphone because of this.
@Krishnachaitanya-dev would you be able to share your configuration?
Upgrading to @supabase/supabase-js": "^2.49.5-next.4 also worked for me
Following
Wasn’t the issue resolved in @supabase/supabase-js@2.49.5-next.1?
Until this issue is fully resolved, you can temporarily fix it by adding the following line to your
metro.config.js:This is another issue. I had the same issue though and I managed to solve it by just trying a lot of stuff. I deleted the node_modules folder and package-lock.json file, then I made some adjustments to the package.json file (the version of some packages). Then I did “npm install”, “npx expo install --fix” and lastly “expo doctor” and then it worked.
I am not sure what was the root cause, but I managed to solve it by just trying like this.
waiting for a solution to the problem:
ERR ->
npm error code ERESOLVE npm error ERESOLVE unable to resolve dependency tree npm error npm error While resolving: rnmpas@1.0.0 npm error Found: react-native-safe-area-context@5.4.0 npm error node_modules/react-native-safe-area-context npm error react-native-safe-area-context@“^5.4.0” from the root project npm error npm error Could not resolve dependency: npm error peer react-native-safe-area-context@“^3.1.9 || ^4.0.0” from @rneui/base@4.0.0-rc.7 npm error node_modules/@rneui/base npm error peer @rneui/base@“4.0.0-rc.7” from @rneui/themed@4.0.0-rc.8 npm error node_modules/@rneui/themed npm error @rneui/themed@“*” from the root project npm error npm error Fix the upstream dependency conflict, or retry npm error this command with --force or --legacy-peer-deps npm error to accept an incorrect (and potentially broken) dependency resolution. npm error npm error npm error For a full report see: npm error /Users/dieresdasilvamendes/.npm/_logs/2025-05-07T21_34_47_228Z-eresolve-report.txt npm error A complete log of this run can be found in: /Users/dieresdasilvamendes/.npm/_logs/2025-05-07T21_34_47_228Z-debug-0.log Error: npm install --save @supabase/supabase-js @rneui/themed react-native-url-polyfill exited with non-zero code: 1
If you create a development build you dont need the expo go app and it wont force you to upgrade SDK. Definitely not as smooth as expo go but seems like the only option right now.
There is always issues when upgrading expo sdk so just dont. Use a dev build instead and downgrade to sdk 52