Prisma

P

Prisma

The official Discord server of Prisma! Find us online at prisma.io

Join

Prisma extension typing with metrics

How can I get proper typing when using dynamic client extensions, while also using the metrics preview feature? I'm currently on: Prisma v.4.16.2 In looking for answers I see this Github Issue that seems to indicate this is not possible, in which case I'd love some feedback about what's the best way forward: https://github.com/prisma/prisma/discussions/21123...

how to integrate prisma postgres with netlify in september?

All the instructions show an outdated interface where you can easily click Netlify integration–however, the interface I see just allows me to set up an OAuth app, which requires a callback URL. I don't have one.

PrismaClient does not exist on @prisma/client error

I have used this method to gen client forever but am getting this error for the first time
No description

schema engine error

I am getting the Schema engin error: I am developing Express backend and prisma + postgreSQL DB from online. I just tried several DBs from prisma.io, neon.com, render.com But I am still getting Schema Engine Error....

Error: Failed to invalidate Accelerate cache. Response was 400 Bad Request. {"code":"P6003","messag

Error: Failed to invalidate Accelerate cache. Response was 400 Bad Request. {"code":"P6003","message":"There is a hold on your account. Reason: planLimitReached. Please contact Prisma support if you think this is an error."} I have basic plan for 10$ and reached only 30k queries....

why does prisma require `db` to be provided in `prisma.schema` if I'm also giving it `directUrl`?

what it says on the tin - I would expect that directUrl would be preferred for e.g. database migrations, and I don't understand why prisma doesn't allow me to only specify the directUrl, since I htink that would be much safer...

Casting Postgres BigInt as TS Number

Hi everyone! I'm using Prisma on my Nest JS application that connects to a Postgres Database. Some fields in this DB are all BIGINT, and Prisma returns them as JS's BigInt. I undertand that in some cases, TS Number may not be able to handle such large numbers as BigInt. But using Number for Postgres BIGINT seems ok for most of the time, since Number supports up to quadrillions. My team and I are trying to figure out a way to return all BIGINT columns as Numbers, since integrating our DB with Prisma is generating some problems (a lot of arithmetic operations are breaking and serialization is not working). I have tried using middlewares, but they can only provide a new column with the value as a number, not override the original column. I have also read about updating pg_types default bigint parser, but was unable to do so in Prisma. Do you have any recommendations? This is really generating a lot of hassle on our projects since updating the ORM is requiring a lot of changes on code....

Can't fetch connections from the connection pool Google Cloud Run

When I initially deploy my new build to Google Cloud Run I get the Timed out fetching a new connection from the connection pool. More info: http://pris.ly/d/connection-pool (Current connection pool timeout: 10, connection limit: 10) error. Eventually it does work. Any insight into this? The only solution online I see that people suggest to change my Cloud Run billing from request based to instance based billing. This isn't super ideal....

Mongodb change streams

I’m considering using Prisma with MongoDB and wanted to check something first. Does Prisma currently support MongoDB change streams (real-time updates)? If not, is support for change streams planned or on the roadmap, or is it considered out of scope?...

Do I need to install the @prisma/client package if I'm using the prisma-client generator?

Basically the question from the title. I'm new to Prisma, currently using v6.16.1 and according to most of the guides that I've read, the @prisma/client package must be installed. But to my understanding, the @prisma/client package is only used to "host" the generated client, which is not the behavior of the new prisma-client generator provider. So, should I still install this package?

Prisma failing to initialise with bun

I am doing:
bun prisma init --datasource-provider sqlte
bun prisma init --datasource-provider sqlte
And I am getting:...

Prisma cannot find wasm module all of a sudden? no changes to versions or schema

I have a simple postgres setup, merely trying to generate models whether within a pipeline when creating a docker container or on my local machine, as of this morning i'm getting this error:
/@prisma+client@6.3.1_prisma@6.3.1_typescript@5.2.2__typescript@5.2.2/node_modules/@prisma/client/runtime/query_engine_bg.postgresql.wasm-base64.js'
/@prisma+client@6.3.1_prisma@6.3.1_typescript@5.2.2__typescript@5.2.2/node_modules/@prisma/client/runtime/query_engine_bg.postgresql.wasm-base64.js'
and i can't build my project, we have a critical bug fix due asap and this is a major blocker as we can no longer build our images, no obvious fix either...

`client.metrics()` Error: Method not implemented.

Why? Is there any linked issues when it will be done? It was working on rust engine, but not working currently with new
generator client {
provider = "prisma-client"
generator client {
provider = "prisma-client"
...

With new `prisma-client` prisma client not included in package.json in final nx build.

When i migrated to the new prisma-client generator, my prisma dependency not included in final nx build of app. My project done in way: 1. libs/database with schema and database logic, with prisma schema setted as: ```...

Pattern for multi-tenant CRUD update routes

Wondering if anyone has a good pattern for handling updates with nested models in multi-tenant setups? My PUT handler needs to validate the data it's given. I'm trying to use the generated Zod schemas for this which let you send in reference/nested models along with the main model (e.g. tags attached to a todo item) through the connect and createOrConnect fields, etc. The problem is I need to validate that all child objects being connected/created/deleted also belong to the correct user - ki...

Invocation of prisma failing in staging deployment

I have upgraded both prisma and @prisma/client to v 6.16.1 , set it up correctly following the docs and everything is working fine in development but in staging environment. For context I have a : monorepo set up with turborepo, api directory under apps/api, nest.js with graphql , ...

Can't find query compiler in 6.16.1

Error upon starting the application: X [ERROR] ENOENT: no such file or directory, open '[workspace].wrangler\tmp\dev-AfQiGT\0ddcddbc869e859f4b11299e1708a489e5afff86-query_compiler_bg.wasm?module' I did not have this issue before upgrading to 6.16. generator client_base {...

Record has changed since last read in table

{ code: 1020, message: "Record has changed since last read in table 'daemon'", state: "HY000" } I get this error once every couple of seconds. I don't really understand why. sure, it might be changed since I read it but I don't care? I'm not sure how to fix...

caching

Ciao, i want to cache the result of a query. What I didn't understand is if the cache works per query parameter. I mean, if I cache user table data for userId=1, if i run a query with userId=2, the second query has a different cache and the output is "where" based?

React strict mode MongoDB race condition

I'm using MongoDB Atlas through Prisma on my Express backend while my frontend uses React & Vite. When I do fetch requests in React they get sent twice because of strict mode. This causes a race condition that creates duplicate documents on creation even when using unique fields in a document. Any smart way to fix this? I know that I can just skip strict mode which decreases chances of simultaneous requests. But even without strict mode I don't like the possibility of an end user being able to create duplicates....