Prisma

P

Prisma

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

Join

AWS Connection

hello there, im using aws to deploy my backend, and vercel for my frontend, for some reasons in localhost it will work to fetch data from my backend, but in my vercel cliney deploy i get this error Mixed Content: The page at 'https://{url}/contacts' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://{url}/api/v1/contacts/details'. This request has been blocked; the content must be served over HTTPS.. i have tried using NGINX with my public IP but it still wont work. how to fix that?...

Optimize in a Constructor

I use prisma in a nest.js api and instantiate a globally used version in a constructor - I've been trying to get optimize to work, and while the console log says it is set up and good to go, no data ever flows through. It looks like this - any idea what I'm doing wrong, or how to do this correctly? ```Typescript export class ApiCoreDataAccessService extends PrismaClient implements OnModuleInit, OnModuleDestroy { public queryCount: number...

Simple questions about modularity

Hi, I am re-structuring my code and I wanted to ask if it makes sense to put al lot off common prisma queries within function, e.g. in a simple getBalance function where I need the account data, I could make an accountService and make the code a bit cleaner in my eyes. Does this makes sense, it's my first big project, and I want to do some best practices cause the code needs to be adaptable with the future in mind. I would appreciate any quick feedback on this from someone more experienced!...
No description

Postgresql freezing, have to restart the app to unfreeze

Hello, I am using NestJS + Prisma + PostgreSQL to develop my app, I am having problems which I can't find cause of issues yet, my app is freezing Postgresql so I have to restart the app to unfreeze, how can I avoid it atleast it must not freeze PostgreSQL

Property 'xxx' is missing in type with relation

Hello, I am new to the prisma ecosystem and I am having a hard time understanding how it works. Here is my current .prisma file structure: ```d model GroupGraphics { groupId Int @id...

Memory leak on binary engine type

I think prisma binary type might have some emmory leak. I have been running my prisma app for over a year now and had memory leak but could not find reason. Yesterday removed binary engine type and it seems to fix the issue.
No description

Enforce uniqueness on Json fields

How can I enforce uniqueness on the post model based on the values in the json fields. here is the schema: ```prisma model Post { id String @id @default(cuid())...

Error P1012 when trying to use Prisma Postgres

Hey there 👋 I'm trying to use Prisma Postgres, but I am getting this error. I am unsure why the DATABASE_URL provided by Prisma would not work? Mine follows the format: prisma+postgres://accelerate.prisma-data.net/?api_key=..." but I get the following error when running npx prisma migrate dev --name init
Error code: P1012
error: Error validating datasource `db`: the URL must start with the protocol `postgresql://` or `postgres://`. To use a URL with protocol `prisma://`, you need to either enable Accelerate or the Data Proxy. Enable Accelerate via `prisma generate --accelerate` or the Data Proxy via `prisma generate --data-proxy.
Error code: P1012
error: Error validating datasource `db`: the URL must start with the protocol `postgresql://` or `postgres://`. To use a URL with protocol `prisma://`, you need to either enable Accelerate or the Data Proxy. Enable Accelerate via `prisma generate --accelerate` or the Data Proxy via `prisma generate --data-proxy.
...

WebStorm issue - not recognizing Prisma client regeneration?

Hi everyone, I am working with Prisma via WebStorm on a TypeScript project. My main issue at the moment is that whenever I run npx prisma generate, it seems I have to restart my IDE for WebStorm to actually notice that the model has been regenerated and index the changes. Does anyone know of a workaround?

Migration containing DML statements hangs mysteriously

Hi, I'm changing the shape of my schema but wanted to preserve existing user data, which is why I wrote a bunch of queries to shape the data into the new format. I created this by using npx prisma migrate --create-only then editing the file to place my data processing steps in between the DDL changes. When I try applying it, it apparently executes the changes on the database, but the migrate command keeps hanging at this step, so I can't trust it to run correctly on my production build. `` prisma:schemaEngine:stderr {"timestamp":"2024-12-05T17:52:23.843630407Z","level":"INFO","fields":{"message":"Applying 20241205134002_change_backorderqueue_grouping_to_sku`",...

Wrong connection pool info ??

On production my queires stopped working with error 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: 9) but actually im on DigitalOcean with another configuration showed on picture....
No description

Question About Prisma Pricing

Hey, if I understand correctly on your website. If I get a subscription and then use Prisma Postgres, I have no query limitation with Accelerate and Pulse?

Cannot run built code when different prisma client output folder

Hi, I came to this problem when I tried to change the prisma client output folder. No matter if I specify folder in src or not, it is not possible to run the build index.js. When I run it in dev, it works just fine. The build completes just fine (when I omit the --dts tag). But when I want to run it, it always fail on error something like: Error: Dynamic require of "child_process" is not supported or Error: Dynamic require of "fs" is not supported ...

Migrating to v6 issues with optimize

Hello, I tried to migrate to v6 from v5, but when I tried to follow the npm commands suggested, this error came up ``` npm warn ERESOLVE overriding peer dependency npm warn While resolving: [project]@0.0.1 npm warn Found: @prisma/client@6.0.1...

Prisma Singleton in Next.js

Hi, I used the Prisma docs (https://www.prisma.io/docs/orm/more/help-and-troubleshooting/help-articles/nextjs-prisma-client-dev-practices) to setup and tested it. In my Next application, I observed the fact that, whenever I navigate between pages, the globalThis is reset, expected one time the Prisma client to be instantiated and used across all the app, but this was not the case. Am I doing something wrong? Does NextJS initiate Prisma on each page? Thank you ...

How to solve this in Prisma, count related entries of complex query

Consider a filtering mechanism as suggested in the linked image. We would like to show the results count depending on each "attribute option". See the prisma schema and trpc route here: https://gist.github.com/riccardolardi/7ab7c9a7792ed9428298630c3b30f22c This approach is evidently very inefficient since it introduces a classic n+1 problem, where we fetch the attributes for the selected category and then loop over each of them and again fetch the count for each attribute option. I can't seem any other solution other than writing a raw SQL query for this kind of problem. Or am I missing something?...
No description

DATABASE_URL environment variable not found

Error: Prisma schema validation - (get-config wasm) Error code: P1012 error: Environment variable not found: DATABASE_URL. --> prisma/schema.prisma:8 | ...

Cannot read properties of undefined (reading 'create')

I'm getting this error with the following schema a creation process: ``` generator client { provider = "prisma-client-js" previewFeatures = ["omitApi"]...

Typed sql only certain parts of query

Hi there, just wondering if there is an issue in place already for a feature to allow escape hatching only certain parts of a query? In my case I would like to escape the orderBy part of the query and keep Prisma ORM everywhere else. Thanks