Open nabilhayek opened 5 months ago
Issue seems to be related to NativeModules returning an empty object. Trying to reference to NativeModules.Prisma
which will give null.
Output: NativeModules {}
Thank you for reporting this Nabil.
To help me narrow this down, can you confirm that you are doing the following:
"plugins": ["@prisma/react-native"]
and running prebuild npx expo prebuild --clean
previewFeatures = ["reactNative"]
in the schema as per the readmenpx prisma@latest migrate dev
npx prisma@latest generate
Prisma relies on a native module, so Expo Go isn't supported at the moment.
Thank you for reporting this Nabil.
To help me narrow this down, can you confirm that you are doing the following:
- Adding the Expo plugin
"plugins": ["@prisma/react-native"]
and running prebuildnpx expo prebuild --clean
- setting
previewFeatures = ["reactNative"]
in the schema as per the readme- generate initial migrations and a database if it doesn't exist:
npx prisma@latest migrate dev
- generating the client:
npx prisma@latest generate
- running prebuild to activate the Expo plugin
Prisma relies on a native module, so Expo Go isn't supported at the moment.
I'm facing same issue. I've tried all steps above, but prisma failed to initialize
Thanks @Skr1pt1k. Now, I'm wondering what's special about your setup. Would you be able to invite me to a repo or create a minimal reproduction I can debug?
I was able to recreate this issue and even solve it I don't know why but when you define the sceham.prisma in some ./**/ directory the prisma is not able to initialize or sometimes access the database same goes for many other issues created on this repo. I was even able to solve it by creating the schema.prisma in the ROOT_DIR of the project which then allows PrismaClient to work perfectly as expected. Other issues which I faced was
Table
not found due to the reason PrismaClient cannot access the DBAlso having this issue. Interesting is that I don't have the issue with the example project https://github.com/sorenbs/budget-buddy-expo. I tried installing the same version of all prisma dependencies in the package.json from that project and mirroring configuration as closely as possible, but I still can't get rid of the error in my own project...
Edit: also working in a new project created with create-expo-app
I figuerd out for me the problem was
npx expo run:android --device
(substitute android for ios if needed) and do not connect via the QR code or the app
import '@prisma/client/react-native';
import { PrismaClient } from '@prisma/client/react-native';
import { reactiveHooksExtension } from "@prisma/react-native";
const basePrisma = new PrismaClient() basePrisma.$applyPendingMigrations(); export const prisma = basePrisma.$extends(reactiveHooksExtension());
PS: Make sure to run `npx prisma generate`
`npx expo prebuild --clean` before all
EDIT: I still receive the error in the console sometimes when reloading, however afterward it initializes fine, applies the migrations without problems and runs all queries. Maybe try if it works for you too
What version of prisma, @prisma/client and @prisma/react-native are you using
The issue also persists for me, even when I run the base project from @sorenbs : https://github.com/sorenbs/budget-buddy-expo with all the prerequisites steps mentioned above. Any potential fixes?
Estou com mesmo problema....
"@prisma/client": "^5.22.0", "@prisma/react-native": "^5.22.0", react-native-quick-base64
Task :prisma_react-native:configureCMakeDebug[arm64-v8a] FAILED C/C++: CMake Error at CMakeLists.txt:10 (add_library): C/C++: Target "react-native-prisma" links to target C/C++: "ReactAndroid::turbomodulejsijni" but the target was not found. Perhaps a C/C++: find_package() call is missing for an IMPORTED target, or an ALIAS target C/C++: is missing? C/C++: CMake Error at CMakeLists.txt:10 (add_library): C/C++: Target "react-native-prisma" links to target C/C++: "ReactAndroid::react_nativemodule_core" but the target was not found. C/C++: Perhaps a find_package() call is missing for an IMPORTED target, or an C/C++: ALIAS target is missing? C/C++: CMake Generate step failed. Build files cannot be regenerated correctly.
Description
When following documentation for in README.md according to the Expo Section I get various warinings/errors in different scenarios.
PrismaClient
instance anywhere in the application gives this warningimport '@prisma/react-native';
anywhere in the application throws this errorExpected Behavior
When following the guidelines outlined in the README.md under the Expo Section, users should be able to integrate Prisma seamlessly into their React Native projects using Expo without encountering warnings or errors mentioned.
Additional Information
The issues described above were observed not only when using the Expo Go app for live testing and development but also during local builds of the application. This was done to ensure that the problems were consistent across different testing environments provided by Expo. Despite trying various configurations and setups in both Expo Go and local builds, the same warnings and errors persisted.