Prisma

P

Prisma

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

Join

How to properly deal with connections pool and disconnects

Hi everyone! At the company that I work, we were facing a problem where too many Prisma connections were making our database slow down considerably, freezing our entire system, we them added a bunch of disconnects after some important and long queries (this is a production env) , the problem was solved, at peak we had 5k connections and now we are sitting at 600ish Now some important parts of our system are throwing the following error: Transaction ID is invalid, refers to an old closed transaction Prisma does not have information about it anymore, or was obtained before disconnecting. We thought that maybe we were disconnecting too much, and possibly affecting ongoing transactions, we are trying to narrow down removing some disconnects, but we fear that our problem with the DB (Postgresql) happens again. I would be glad if someone could provide some guidance, what should be investigated, and possible solutions...

Issues with Prisma in Turborepo

I'm essentially generating the client and compiling a commonjs version so that i can use my Prisma client across our monorepo. this works, however, when i try to extend the client to use extensions, it breaks with the following error:
Error: Cannot find module '.prisma/client/default'
Error: Cannot find module '.prisma/client/default'
I've been at this for a day now, and I'm slowly losing my sanity with this. I don't understand why extending the client would break it. I tried looking for flags to include extensions in the generated client but couldn't find anything....
No description

What is the good practice for migrations and keeping them on GitHub?

Hello, I started my full stack project and currently we are in dilemma. Here is the scenario, our database will update accordingly with the project, we want to release some feature later let's use Reddit karma for example which is (I assume) only one table column added, if our project already has a lot of online users is there a way we can update our database without resetting and how to do it? I assume it is with prisma migrations, if that is the case, should we keep the migration files on our GitHub repository or are we allowed to either delete them or add them to .gitignore? Thank you in advance....

Find the way to write unit-test by postgres in memory db

Hi, I'm starting to write unit-test but I don't want to use docker to mock DB. Any way to use in memory postgres db?

Prisma postgres and replicas

Hi, I'm starting to use Prisma postgres on a new project. For that project, we will need to be able to plug data from the database to the datalake....

How are the cold starts?

How are prisma coldstarts on cloud functions/serverless environments, like Lambdas?

Prisma schemas and plugins

Hello everyone, So here's my issue - We're working on a project that has a plugin architecture. Basically there's a main program and different plugins that run on top of it (similar to Wordpress). Plugins are loaded dynamically using "away import". It should be noted that we use MongoDB as a backend. There is a collection with a list of plugins to be loaded. There's a main schema with general collections, and plugins can create their own plugin-specific collections as well. A plugin may also access collections in the general schema, but not the other way around. Installing a plugin is as simple as copying its js file into a plugins subdirectory (if it's written in TypeScript it has to be precompiled), and running a plugin specific install script. The main program is not rebuilt when a plugin is installed. It should be noted that plugins do not have their own copy of node_modules, since they're not considered as separate apps. So, I think you see where I'm going with this - How do I deal with various plugins, that are loaded dynamically, with each having its own schema without having them overwrite each other? And how do we allow a plugin to access the main schema?...

Nullable Datetime Field

hello i'm trying to create a field last_purchase_date but there's a case where user has not purchased yet so i want the field to be null. this is what i have in schema.prisma ``` model Item {...

ConnectorError after moving to Prisma Postgres

I am in the process of migrating from a Neon postgres db to a Prisma Postgres db. I followed the migration docs to transfer my data and table structure: https://www.prisma.io/docs/getting-started/prisma-postgres/import-from-existing-database-postgresql After doing this, I am able to load all data, but any delete or update is failing with this error: ```...

Next + Cloudflare Workers + D1

I'm trying to use Prisma in a Next app on Cloudflare Workers and D1. I have gone through all the setup steps and tried to use the ...FORCE_WASM...=1 But on actual deploy, I keep getting fs.readdir not available. My understanding is that this should work, that prisma supports edge runtimes (examples for prisma+d1 exist), and that something is not being built or setup right such that prisma doesn't try to use functions it knows it shouldn't in an edge runtime...

Vite + D1 + Cloudflare Workers + Prisma

I've used Prisma + D1 + Cloudflare workers before and it's been a great experience. I'm not trying to use the same tack with Vite + Honox (https://github.com/honojs/honox/tree/main) in the mix. My vite config uses two plugins:...

Latency to/from US-east <-> US-east and Denmark <-> Paris

Really struggling with long latency for my queries - are these numbers what I can expect from your hosted Postgres solution ? (Thx. for the ORM btw - really awesome). I am currently assessing your hosted solution and on paper it looks great, but I am really struggling with large latencies. I am situated in Denmark and am doing tests against a database in Paris, but experiencing same long latency when using a database in US east with a Vercel hosted solution in US east as well....
No description

<fields> is missing.

Created a simple post request that should create a user with a specific name, but I get an error ```prisma generator client { provider = "prisma-client-js" }...

PgBouncer and Prisma

hi! if my db has a 500 connection limit and i'm using pgbouncer in between, with prisma, what should the connection_limit be set to in my db string? i see these strange spikes where queries suddenly start taking much, much, longer and the database is not struggling nor is the application code. my hunch is that prisma connections are somehow backing up / not being freed up correctly and it's leading to a backed up queue. ...

Prisma initialization failing in prod Prisma Postgres

``⨯ Error [PrismaClientInitializationError]: Invalid prisma.user.findUnique() invocation: error: Error validating datasource db: the URL must start with the protocol postgresql:// or postgres://`....

Many to two relation

Hey, I have these model ``` model a { id String @id @default(cuid())...

postgress migration error

I'm following your instructions for migration (https://www.prisma.io/docs/getting-started/prisma-postgres/upgrade-from-early-access) for Windows. I set the env variable DATABASE_URL (with SET, export shows an error - set DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/?api_key=ey..."). Once i set the variable i launch npx @prisma/ppg-tunnel --host 127.0.0.1 --port 5432 i receive the following error `PS C:\Users\MyPC> npx @prisma/ppg-tunnel --host 127.0.0.1 --port 5432 file:///C:/Users/MyPC/AppData/Local/npm-cache/_npx/cdc1c80c7d03f8e1/node_modules/@prisma/ppg-tunnel/dist/index.js:117...

Removed accelerate but keeps asking for database url that start swith prisma://

After I removed accelerate from my project, my live database keeps asking me for the prisma url string(related to accelerate). Nothing I am doing will overcome this. Has anyone else had this issue?

creating a BM25 index

I have created a BM25 index by creating a migration file to create it and also added the schema to ignore the index. ``` model Post { id Int @id @default(autoincrement())...
Next