Amit
07/13/2021, 2:07 PMnApi :
Error: invalid type: boolean `true`, expected a string
at LibraryEngine.loadEngine (node_modules/@prisma/client/runtime/index.js:23613:27)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at LibraryEngine.instantiateLibrary (node_modules/@prisma/client/runtime/index.js:23557:7)
Anyone got any idea why? When not using nApi it works fine.Ryan
07/13/2021, 2:09 PMschema.prisma? I tried upgrading from 2.26.0 to 2.27.0 and ran prisma generate with nApi and works fine on a sample schema.Amit
07/13/2021, 2:10 PMAmit
07/13/2021, 2:11 PMgenerator client {
provider = "prisma-client-js"
binaryTargets = ["native", "rhel-openssl-1.0.x", "linux-musl"]
previewFeatures = ["nApi"]
}
datasource postgresql {
provider = "postgresql"
url = env("POSTGRES_URL")
}Amit
07/13/2021, 2:12 PMenum, model, etc) which I will not share š sorry!Amit
07/13/2021, 2:14 PMRyan
07/13/2021, 2:16 PMgenerator client {
provider = "prisma-client-js"
binaryTargets = ["native", "rhel-openssl-1.0.x", "linux-musl"]
previewFeatures = ["nApi"]
}
datasource postgresql {
provider = "postgresql"
url = env("POSTGRES_URL")
}
model User {
id Int @id @default(autoincrement())
name String
}Amit
07/13/2021, 2:16 PMRyan
07/13/2021, 2:18 PMAmit
07/13/2021, 2:24 PMAmit
07/13/2021, 2:24 PMAmit
07/13/2021, 2:24 PMjanpio
Amit
07/14/2021, 5:17 PMprisma generate? I mean to ask: is this a change that was done on purpose?
2.24.1:
Prisma schema loaded from schema.prisma
ā Generated Prisma Client (2.24.1) to ./../../node_modules/@prisma/client in 1.15s
You can now start using Prisma Client in your code. Reference: <https://pris.ly/d/client>
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()```
2.26.0 and 2.27.0:
Prisma schema loaded from schema.prisma
:heavy_check_mark: Generated Prisma Client (2.27.0) to ./node_modules/@prisma/client in 529ms
You can now start using Prisma Client in your code. Reference: <https://pris.ly/d/client>
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()```Amit
07/14/2021, 5:18 PMschema.prisma was not changed between the versionsAmit
07/14/2021, 5:18 PMoutput = "../../node_modules/@prisma/client"
But there are some other problems which I don't yet understandAmit
07/14/2021, 5:22 PMoutput in schema.prisma I'm receiving the following error:
Error: Cannot find module './runtime'Amit
07/14/2021, 5:23 PMnApi from preview features it works fine šAmit
07/14/2021, 5:23 PMjanpio
janpio
pnpm by chance? We fixed and changed a few of the path detections there, and this looks like a possible side effect. What exactly happens there in all configuration - and even what is supposed to happen - is not super well understood šAmit
07/19/2021, 1:35 PMAmit
07/19/2021, 1:35 PMAmit
08/01/2021, 11:50 AM{
"code": "InvalidArg",
"clientVersion": "2.28.0"
}Amit
08/01/2021, 1:40 PMAmit
08/01/2021, 1:40 PMAmit
08/01/2021, 1:46 PMtrue (not a string), it causes Prisma to go ššAmit
08/01/2021, 1:56 PMserverless patches process but I might be wrongAmit
08/01/2021, 1:58 PMruntime/index.js I'm changing the initialization of QueryEngineConstructor, such that the env parameter has some boolean value, it fails. For example:
try {
this.engine = new this.QueryEngineConstructor({
datamodel: this.datamodel,
env: { DATABASE_URL: process.env.DATABASE_URL, AAA: true },
...
Then it fails with the same errorAmit
08/01/2021, 2:39 PMRecord<string, string> , it's not a bug in Prisma but rather something else transforms the boolean string to boolean values along the way. Anyway this was the issue, thanks for the help!Amit
08/01/2021, 2:39 PMAmit
08/01/2021, 4:20 PMprocess.env.IS_OFFLINE to be true (e.g. boolean and not a string), so prisma + serverless-plugin-offline won't play well together sadly (see this line)Amit
08/02/2021, 10:58 AMenv mapping to override process.env?