P
Prisma2w ago
qode

panicked at query-engine\query-engine-node-api\src\engine. Failed to deserialize constructor options

Hi guys. I have a shared prisma package setup in one repo, and 2 other repositories (frontend and server) that use the shared prisma package. This setup has been working very fine for a long time. but just today i added a new table and deployed the updated package (something i do every week). and it's craching my servers. On the other projects, reinstalling the latest version of the shared package and running the projects throws this error:
values for data_model, log_level, and any field that is not Option<T>
[1] : Error { status: InvalidArg, reason: "missing field `enableTracing`", maybe_raw:
0x0 }
values for data_model, log_level, and any field that is not Option<T>
[1] : Error { status: InvalidArg, reason: "missing field `enableTracing`", maybe_raw:
0x0 }
dist/index.ts
import { PrismaClient } from '@prisma/client'
import {PrismaClientContext} from './index.d'

const prisma = new PrismaClient()

export const prismaClientContext: PrismaClientContext = {
prisma
}
import { PrismaClient } from '@prisma/client'
import {PrismaClientContext} from './index.d'

const prisma = new PrismaClient()

export const prismaClientContext: PrismaClientContext = {
prisma
}
shema.prisma
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "debian-openssl-3.0.x", "linux-musl"]
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

// ...
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "debian-openssl-3.0.x", "linux-musl"]
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

// ...
No description
3 Replies
Prisma AI Help
You chose to compile with the bot. One moment while I piece together your answer… Based on the error message and your description, it appears you're experiencing a Prisma panic related to engine initialization. This is likely related to a version mismatch or missing configuration for the tracing feature. Understanding the Error The error message indicates that the Query Engine is missing a required field called enableTracing. This suggests you might be using a newer version of Prisma that has the tracing feature enabled by default or as a required configuration parameter. Possible Solutions 1. Check Prisma Version Compatibility The error might be occurring because you've updated to Prisma 6.1.0, which has known issues with tracing. As mentioned in this issue, there's a specific error related to tracing in version 6.1.0:
TypeError: this.getGlobalTracingHelper(...).dispatchEngineSpans is not a function

TypeError: this.getGlobalTracingHelper(...).dispatchEngineSpans is not a function

2. Add Tracing Configuration You could try explicitly adding the tracing configuration to your PrismaClient initialization:
const prisma = new PrismaClient({
// Explicitly set tracing configuration
enableTracing: false
})

const prisma = new PrismaClient({
// Explicitly set tracing configuration
enableTracing: false
})

3. Downgrade Prisma Version If you recently updated your Prisma version, consider downgrading to a previous stable version (like 6.0.1) until the issue is resolved, as suggested in the Tracing error in 6.1.0 issue. 4. Update Schema Configuration You might need to update your schema.prisma file to explicitly handle the tracing feature:
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "debian-openssl-3.0.x", "linux-musl"]
previewFeatures = ["tracing"] // Add this if you want to use tracing
}

generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "debian-openssl-3.0.x", "linux-musl"]
previewFeatures = ["tracing"] // Add this if you want to use tracing
}

5. Check for Observability Tools If you're using observability tools like Sentry, they might not be compatible with the latest Prisma version's tracing feat ures, as mentioned in the GitHub issue. This appears to be a known issue with certain Prisma versions, particularly around the tracing functionality. I recommend trying the solutions above, with downgrading to a previous stable version being the quickest fix if you need to get your application running immediately. 🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly. In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.
qode
qodeOP2w ago
Fixed: the issue was that when other projects use my prisma package. they install the latest version of @prisma/client as dep which is incompatible with the package version. there are many fixes. but i went for setting up custom output for the prisma client in the package at ./prisma/generated/client. Then i edit shema.prisma to:
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "debian-openssl-3.0.x", "linux-musl"]
output = "./prisma/generated/client"
}
generator client {
provider = "prisma-client-js"
binaryTargets = ["native", "debian-openssl-3.0.x", "linux-musl"]
output = "./prisma/generated/client"
}
And then removing the postinstall and bundling in package.json, replacing it with prepare script.
{
"name": "@orgname/prisma-client-package",
"version": "1.3.6",
"description": "Shared Prisma Client as Internal Package",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"author": "Orgname <[email protected]>",
"scripts": {
"build": "tsc",
"prisma:migrate": "npx prisma migrate dev --name init",
"prisma:introspect": "npx prisma introspect",
"prisma:generate": "npx prisma generate",
"prisma:push": "npx prisma db push",
"start": "npx prisma studio",
"prepare": "npx prisma generate && tsc && cp src/index.d.ts dist/index.d.ts",
"postinstall": "echo 'postinstall complete.'",
"test": "echo \"Error: no test specified\" && exit 0"
},
"repository": {
"type": "git",
"url": "https://github.com/orgname/prisma-client-package.git"
},
"license": "MIT",
"dependencies": {
"@prisma/client": "5.16.1",
"dotenv": "^16.4.5"
},
"devDependencies": {
"@types/node": "^20.11.17",
"prisma": "5.16.1",
"typescript": "5.0.4"
},
"bundledDependencies": [],
"files": [
"dist",
"scripts",
"schema.prisma",
"prisma/generated/client"
],
"publishConfig": {
"access": "restricted",
"registry": "https://npm.pkg.github.com"
}
}
{
"name": "@orgname/prisma-client-package",
"version": "1.3.6",
"description": "Shared Prisma Client as Internal Package",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"author": "Orgname <[email protected]>",
"scripts": {
"build": "tsc",
"prisma:migrate": "npx prisma migrate dev --name init",
"prisma:introspect": "npx prisma introspect",
"prisma:generate": "npx prisma generate",
"prisma:push": "npx prisma db push",
"start": "npx prisma studio",
"prepare": "npx prisma generate && tsc && cp src/index.d.ts dist/index.d.ts",
"postinstall": "echo 'postinstall complete.'",
"test": "echo \"Error: no test specified\" && exit 0"
},
"repository": {
"type": "git",
"url": "https://github.com/orgname/prisma-client-package.git"
},
"license": "MIT",
"dependencies": {
"@prisma/client": "5.16.1",
"dotenv": "^16.4.5"
},
"devDependencies": {
"@types/node": "^20.11.17",
"prisma": "5.16.1",
"typescript": "5.0.4"
},
"bundledDependencies": [],
"files": [
"dist",
"scripts",
"schema.prisma",
"prisma/generated/client"
],
"publishConfig": {
"access": "restricted",
"registry": "https://npm.pkg.github.com"
}
}
Nurul
Nurul2w ago
I am glad to hear that you were able to identify the cause and fix it 👍

Did you find this page helpful?