Error: 🟥 @prisma/react-native failed to initialize, js engine: hermes
getting this error message for expo da prisma connection
db.ts in root directory
import "@prisma/react-native";
import { PrismaClient } from "@prisma/client/react-native";
import { reactiveQueriesExtension } from "@prisma/react-native";
const baseClient = new PrismaClient({
log: ["query", "info", "warn"],
});
export const prismaClient = baseClient.$extends(reactiveQueriesExtension());
export async function initializeDb() {
try {
baseClient.$applyPendingMigrations();
} catch (e) {
console.error(
failed to apply migrations: ${e}
);
throw new Error(
"Applying migrations failed, your app is now in an inconsistent state. We cannot guarantee safety, it is now your responsibility to reset the database or tell the user to re-install the app"
);
}
}
schema.prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["reactNative"]
}
datasource db {
provider = "sqlite"
url = "file:./app.db"
}
model User {
id Int @id @default(autoincrement())
name String
surname String
}2 Replies
App.tsx
import React, { useEffect, useState } from "react";
import { StatusBar } from "expo-status-bar";
import { Text, View, TouchableOpacity, ActivityIndicator } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import { initializeDb } from "@/db";
export default function WelcomeScreen() {
const [isInitialized, setIsInitialized] = useState(false);
useEffect(() => {
(async () => {
await initializeDb();
setIsInitialized(true);
})();
}, []);
if (!isInitialized) {
<View>
<ActivityIndicator size={"large"} color={"#000"} />
</View>;
}
return (
<SafeAreaView className="flex-1 bg-white">
<StatusBar style="dark" />
<View className="flex-1 justify-center items-center px-6">
<Text className="text-4xl font-bold mb-6 text-center text-gray-800">
Welcome to My App!
</Text>
<Text className="text-lg text-gray-600 mb-8 text-center">
Get started with our amazing features and explore the app.
</Text>
<TouchableOpacity
className="bg-blue-500 py-3 px-8 rounded-full active:bg-blue-600"
onPress={() => console.log("Get Started pressed")}
>
<Text className="text-white font-semibold text-lg">Get Started</Text>
</TouchableOpacity>
</View>
</SafeAreaView>
);
}
Hey @SyntaxFear 👋
Do you mind sharing this in #orm-for-expo-feedback channel for better visibility?