prisma-client-go icon indicating copy to clipboard operation
prisma-client-go copied to clipboard

support for "jsonProtocol"

Open stillmatic opened this issue 1 year ago • 2 comments

Minimally reproducible example -- take quickstart and add a JS generator. See https://github.com/steebchen/prisma-client-go/issues/877, but you can generate with npx prisma db push and then run go run main.go

datasource db {
  // could be postgresql or mysql
  provider = "sqlite"
  url      = "file:dev.db"
}

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["jsonProtocol", "views"]
}
 
generator db {
  provider = "go run github.com/steebchen/prisma-client-go"
}

model Post {
  id        String   @default(cuid()) @id
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  title     String
  published Boolean
  desc      String?
}

However, I get error

{"level":"fatal","error":"request failed: http status code 422 with response {\"is_panic\":false,\"message\":\"Error parsing Json query. data did not match any variant of untagged enum JsonBody\",\"backtrace\":null}","time":"2023-06-17T14:04:38-04:00","message":"Could not connect to Prisma."}

Removing the jsonProtocol from JS client works, as does generating the clients one at a time (e.g. commenting out the JS generator with jsonProtocol enabled).

stillmatic avatar Jun 17 '23 18:06 stillmatic

Yes, jsonProtocol is currently not supported in the Go client, and it should not be a big deal to implement. Just haven't gotten to it yet

steebchen avatar Jun 18 '23 00:06 steebchen

any update?

anupriya17 avatar Mar 15 '24 17:03 anupriya17