prisma-generator-drizzle icon indicating copy to clipboard operation
prisma-generator-drizzle copied to clipboard

`prisma generate` throw Error: `Expected property name or '}' in JSON at position 29`

Open TenviLi opened this issue 11 months ago • 9 comments

I followed the instructions in the README and executed the relevant commands.

However, when I reached the following command, an error occurred.

I searched extensively on search engines but couldn't find a solution.

image

generator client {
  provider = "prisma-generator-drizzle"
}

datasource db {
  provider = "sqlite"
  url      = "file:../prisma.db"
}

model User {
  id    Int     @id @default(autoincrement())
  email String  @unique
  name  String?
}
prisma:engines binaries to download libquery-engine, schema-engine +156ms
prisma:get-platform Found distro info:
{
  "targetDistro": "debian",
  "familyDistro": "debian",
  "originalDistro": "ubuntu"
} +4ms
prisma:get-platform Trying platform-specific paths for "debian" (and "ubuntu") +0ms
prisma:get-platform Found libssl.so file using platform-specific paths: libssl.so.3 +0ms
prisma:get-platform The parsed libssl version is: 3.0.x +0ms
prisma:loadEnv project root found at /home/work/package.json +246ms
prisma:tryLoadEnv Environment variables loaded from /home/work/.env +5ms
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
prisma:getConfig Using getConfig Wasm +3ms
prisma:getConfig config data retrieved without errors in getConfig Wasm +7ms
prisma:get-platform Found distro info:
{
  "targetDistro": "debian",
  "familyDistro": "debian",
  "originalDistro": "ubuntu"
} +1ms
prisma:get-platform Trying platform-specific paths for "debian" (and "ubuntu") +0ms
prisma:get-platform Found libssl.so file using platform-specific paths: libssl.so.3 +1ms
prisma:get-platform The parsed libssl version is: 3.0.x +0ms
prisma:getConfig Using getConfig Wasm +34ms
prisma:getConfig config data retrieved without errors in getConfig Wasm +1ms
prisma:getDMMF Using getDmmf Wasm +0ms
prisma:getDMMF Using given datamodel +0ms
prisma:getDMMF dmmf data retrieved without errors in getDmmf Wasm +36ms
prisma:getGenerators neededVersions {} +294ms
Error: Error: 
Expected property name or '}' in JSON at position 29


    at Mf.parse (/home/work/node_modules/.pnpm/[email protected]/node_modules/prisma/build/index.js:1413:71)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Rgt (/home/work/node_modules/.pnpm/[email protected]/node_modules/prisma/build/index.js:1892:280)

TenviLi avatar Mar 14 '24 16:03 TenviLi

prisma:getGenerators neededVersions {} +294ms Error: Error: Expected property name or '}' in JSON at position 29

at Mf.parse (/home/work/node_modules/.pnpm/[email protected]/node_modules/prisma/build/index.js:1413:71)

Hey, at first glance, it looks like it comes from the Prisma engine. You can try removing the prisma-generator-drizzle plugin and see if the problem persists.

fdarian avatar Mar 14 '24 22:03 fdarian

prisma:getGenerators neededVersions {} +294ms Error: Error: Expected property name or '}' in JSON at position 29

at Mf.parse (/home/work/node_modules/.pnpm/[email protected]/node_modules/prisma/build/index.js:1413:71)

Hey, at first glance, it looks like it comes from the Prisma engine. You can try removing the prisma-generator-drizzle plugin and see if the problem persists.

generator client {
  provider = "prisma-client-js"
}

no problem image

"@prisma/client": "5.10.2",
"better-sqlite3": "^9.4.3",
"drizzle-kit": "^0.20.14",
"prisma": "5.10.2",
"prisma-generator-drizzle": "^0.6.6",
"drizzle-orm": "^0.30.2",

TenviLi avatar Mar 15 '24 12:03 TenviLi

Do you mind sending me a reproduction repo so I can take a better look?

fdarian avatar Mar 16 '24 02:03 fdarian

@TenviLi this might be unrelated, could you also try using bun 1.0.30?

To install a specific version of bun, follow this step to uninstall and find the "install specific version" here.

fdarian avatar Mar 22 '24 00:03 fdarian

I have the same error unfortunatly :/ (Bun 1.0.35 / Prisma 5.2.0)

If you want to test it, I can give you an example :


datasource db {
  provider = "postgresql"
  url      = "postgresql://docker:docker@localhost:5432/project"
}
generator drizzle {
  provider = "prisma-generator-drizzle"

}

model Token {
  id           String @id @unique @default(uuid())
  refreshToken String
  accessToken  String

  owner   User   @relation(fields: [ownerId], references: [id])
  ownerId String

  createdAt DateTime @default(now())
}

model User {
  id            String  @id @unique @default(uuid())

  tokens          Token[]

  createdAt       DateTime         @default(now())
  updatedAt       DateTime         @updatedAt
}

qlaffont avatar Mar 27 '24 10:03 qlaffont

@qlaffont @TenviLi It seems that the problem is arising from comments in the tsconfig.json file, as JSON does not support comments by default. I've just released version 0.6.7 to address this issue. Please give it a try and let me know if it doesn't resolve the issue.

fdarian avatar Apr 02 '24 12:04 fdarian

Nop :/

> [email protected] generate /home/quentin/Documents/dev/perso/starter-api
> prisma generate

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Error: 
Expected double-quoted property name in JSON at position 622

qlaffont avatar Apr 03 '24 06:04 qlaffont

Nop :/

> [email protected] generate /home/quentin/Documents/dev/perso/starter-api
> prisma generate

Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Error: 
Expected double-quoted property name in JSON at position 622

Do you mind to modify this repository to reproduce your error?

fdarian avatar Apr 05 '24 10:04 fdarian

Strange I don't reproduce the error with deps I have installed...

qlaffont avatar Apr 05 '24 14:04 qlaffont

Feel free to reopen if the issue persists.

fdarian avatar Jul 05 '24 12:07 fdarian