sdk-for-react-native: đ Bug Report: TurboModuleRegistry.getEnforcing(...): 'PlatformConstants' could not be found
đ Reproduction steps
Hello together,
I am building an Expo / RN app and try to implement my authentication with the createMagicURLToken() function.
I followed all documentation steps to create my Appwrite client like the following:
import { Account, Client } from "react-native-appwrite";
const client = new Client()
.setEndpoint("https://cloud.appwrite.io/v1")
.setProject("PROJECT_ID")
.setPlatform("PLATFORM");
export const account = new Account(client);
In my authentication part I use createMagicURLToken like in the docs explained:
import { ID } from "react-native-appwrite";
try {
const token = await account.createMagicURLToken(
ID.unique(),
"email@example.com",
"URL"
);
return { token };
} catch (error) {
console.error(error);
}
At this point, when the createMagicURLToken is executed, my application crashes with the following message:
Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'PlatformConstants' could not be found. Verify that a module by this name is registered in the native binary.Bridgeless mode: true. TurboModule interop: false. Modules loaded: {"NativeModules":[],"TurboModules":[],"NotFound":["PlatformConstants"]}
âš
I saw that this library has the following dependencies and was thinking if this might be a problem with the react-native version. I use the newest 0.77.0 like described later in my environment settings.
"dependencies": {
"expo-file-system": "16.0.8",
"react-native": "^0.73.6"
},
đ Expected behavior
That the function runs through or at least giving me a better instruction what might gone wrong.
đ Actual Behavior
đ˛ Appwrite version
Different version (specify in environment)
đť Operating system
MacOS
đ§ą Your Environment
I use appwrite in the cloud, so it should be v1.6.x
expo: 52.0.33
react-native: 0.77.0
react-native-appwrite: 0.7.0
react-native-url-polyfill: 2.0.0
Devices:
- iPhone 15 Pro Max (iOS 17.2 - Simulator)
- iPhone 14 Pro (iOS 18.1.1)
đ Have you spent some time to check if this issue has been raised before?
- I checked and didnât find similar issue
đ˘ Have you read the Code of Conduct?
- I have read the Code of Conduct
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 5
- Comments: 36 (6 by maintainers)
While we work on a permanent fix, please see if this workaround helps:
node_modulesandpackage-lock.jsonnpm icurrently i am getting this issue, only happened after upgrading to expo 53 and enabling newArch
this is blocking ⌠i canât progress with developement , this will lead to devs switching to another solution @ChiragAgg5k
this repro repo link https://github.com/abdeljalilait/platformconstants-could-not-found-repro
I upgraded to SDK 53 a few hours ago as my project was on SDK 52 and the current expo go would not work on older SDKâs im running into the same issue i checked all the react native versions and they are up to date. any updates on the situation?
I am getting this issue when i upgraded to expo 53 too
Sadly this does not fix it. you can see the new architecure is disabledâŚ
âreact-nativeâ: â0.79.2â âexpoâ: â^53.0.7â âreactâ: â19.0.0â I donât use appwrite
@akshaykumar059004 Doing
npx expo install --fixdidnât change anything for me. I donât have any dependency conflicts either. Can you share your versions for expo, react-native, react and appwrite sdk?Me too guys. How to fix this? I tried downgrading RN to 0.76.5 but didnât help.
The issue should be fixed with the latest release of the sdk via the PR - https://github.com/appwrite/sdk-generator/pull/1073
Please upgrade to version 0.7.4
just trun ânewArchEnabledâ: false in app.json
itâs work for me
{ âexpoâ: { ânameâ: âSCRAPX-2â, âslugâ: âSCRAPX-2â, âversionâ: â1.0.0â, âorientationâ: âportraitâ, âiconâ: â./assets/images/icon.pngâ, âschemeâ: âscrapx2â, âuserInterfaceStyleâ: âautomaticâ, ânewArchEnabledâ: false, âiosâ: { âsupportsTabletâ: true }, âandroidâ: { âadaptiveIconâ: { âforegroundImageâ: â./assets/images/adaptive-icon.pngâ, âbackgroundColorâ: â#ffffffâ }, âedgeToEdgeEnabledâ: true, âpackageâ: âcom.scrapxappâ }, âwebâ: { âbundlerâ: âmetroâ, âoutputâ: âstaticâ, âfaviconâ: â./assets/images/favicon.pngâ }, âpluginsâ: [ âexpo-routerâ, [ âexpo-splash-screenâ, { âimageâ: â./assets/images/splash-icon.pngâ, âimageWidthâ: 200, âresizeModeâ: âcontainâ, âbackgroundColorâ: â#ffffffâ } ] ], âexperimentsâ: { âtypedRoutesâ: true } } }
Thanks, can confirm this worked for me.
Unfortunatelly also didnât do anything for me, is this issue still being looked at ?
When using latest expo go app you must use expo 53 sdk. Have you tested app write with expo 53?
I dont think simply screenshoting errors back to 2024 is good support tbh.
a quick fix, using expo Device module can solve this issue, instead of Platform module from react native, as in the sdk itself
and i donât think i can create a pull request with the fix. and i am not sure if this fix would even be viable with the sdk, but for now it works well, iâve made a npm package and i am using it in my app for now
Same issue after upgrading to expo 53 and resolving all dependencies.
@nolliebigspin i see, thanks for replying. i will raise the concern with the internal team and double check to see if the issue is reproducable before closing it đ