Prisma

P

Prisma

Join the community to ask questions about Prisma and get answers from other members.

Join

Prisma Transactions stops working once you extend the client with Pulse, Optimize or Accelerate

See title. This stops me from migrating to these products and use in production. Once you extend the client and need to make a Prisma Transaction it will return an error and the transaction fails: TypeError: parentTracer.getSpanLimits is not a function...

Can't set api key/token when using Optimize

The documentation says to add the apikey as follows ```ts import { PrismaClient } from "@prisma/client"; import { withOptimize } from "@prisma/extension-optimize"; ...
No description

Optimize is not showing queries

I've been trying to get optimize to work since it first launched in beta, but queries just don't show up in the dashboard. i'm not sure how to get more logging......

Safe Rolling Deployments When Dropping Columns

Hello, I'm wondering if there are tricks or advice to drop columns safely in production w/ rolling deployments. Here's some context to explain the problem and what I mean by rolling deploys: * dev adds column X to table A in PR-1 * column X is picked up automatically included in Prisma queries on table A like... prisma.client.tableA.findMany({ where: id }) * PR-1 is deployed to PRD and column X is added as a prequisite to rolling out the new version...

Advisory lock errors in CI suddenly ocurring very frequently

I have a newish (about 2 months old) next.js app with prisma deployed on Vercel. Lately I'm getting Error: P1002 on about 75% of my builds, even when there are minutes between builds.
Context: Timed out trying to acquire a postgres advisory lock (SELECT pg_advisory_lock(72707369)). Elapsed: 10000ms. See https://pris.ly/d/migrate-advisory-locking for details.
Context: Timed out trying to acquire a postgres advisory lock (SELECT pg_advisory_lock(72707369)). Elapsed: 10000ms. See https://pris.ly/d/migrate-advisory-locking for details.
...

Drift detected after migration reset

Hi, I'm having trouble with adding changes to our db because of Drift detected issue, event after. I did the ff migration reset --force ``` ...

Supabase with Pulse and Accelerate

Hi! I am setting op Supabase in combination with Fly, Pulse and Accelerate. I received two URLS: A connection pooler URL A direct URL ...

Whenever you extend your PrismaClient with Pulse, you don't have access to $on anymore. Why?

Why is it possible to do this: ```ts const client = new PrismaClient({ log: [...
No description

deep nested create takes so much time to complete

PFA reproduction code ` npm install npx prisma generate npm run dev...

Return Type With Relations

Hello there, I have a quick question about return type with relation. If I have this sort of query: ```ts...

Why always encounter this error after few mins

Due to this im not able to able to work properly... PrismaClientUnknownRequestError: \nInvalid prisma.users.findUnique() invocation:\n\n\nError occurred during query execution:\nConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(PostgresError { code: "42P05", message: "prepared statement \"s4\" already exists", severity: "ERROR", detail: None, column: None, hint: None }), transient: false })...

Is SQlite supported any time soon? Pulse & Accelerate

Hi! Wondering if this is on the roadmap or not. Migrating my stack to Postgres is kind of a pain.
Solution:
Hi @DennisK πŸ‘‹ The support for SQLite in both Pulse and Accelerate is not currently on the roadmap....

Cursor based paging issue for multilevel relationships

I have this query. As you can see my paging field's like cursors are inside the select: works section. Question completes in the next post. ```typescript const works = await this.#client.follow.findMany({ select: { followed: {...

postgres db collation error

``` riginal error: ERROR: template database "template1" has a collation version mismatch DETAIL: The template database was created using collation version 2.39, but the operating system provides version 2.40. HINT: Rebuild all objects in the template database that use the default collation and run ALTER DATABASE template1 REFRESH COLLATION VERSION, or build PostgreSQL with the right library version....

Prisma (with MongoDB) sort based on their related field

Hi! How can I retrieve all users from the User model in Prisma (with MongoDB), and sort them based on their total points from the related ShadePoints model? I am currently using Prisma with MongoDB, What is the best way to sort users by the sum of their related ShadePoints.points using Prisma? Is there an example using or an alternative approach? model User {...

accessing prisma generated enums on browser client

in my prisma schema I have an enum called Sizes with the values of s, m, l, xl i can access that enum in on the server by importing import { Sizes } from "@prisma/client"; but whenever I import the same thing in a svelte file, the Sizes become undefined I temporarily fixed it by copying the values of the prisma generated Sizes...
Solution:
fixed this by passing the values of Sizes from server to client

Prisma SQLite

how to insert data inside the a table in prisma sqlite for internal table which are used only for linking and the data never get's changed

Supabase postgres not working sometime

So I'm working on a project using next.js and a simple CMS. Now I wanted to use supabase as a Backend for the project (bacause it has a free tier). To use postgres I decided to go with Prisma. But for some reason the project automatically disconnects from the supabase postgres. Sometime it works sometime it doesnt. Now I know that this is not enough information. So I tried to find the answer by changing passwords. Restarting supabase project, but it still showing the same stuff after sometime. I followed the official guide by supabase but the problem still exists....

Deploy to vercel with supabase as database

I am trying to deploy a Sveltekit app to Vercel using Supabase as my database and I am getting an error saying that I need to use an adapter for edge runtime:
Error: PrismaClient is not configured to run in Edge Runtime (Vercel Edge Functions, Vercel Edge Middleware, Next.js (Pages Router) Edge API Routes, Next.js (App Router) Edge Route Handlers or Next.js Middleware). In order to run Prisma Client on edge runtime, either:
- Use Prisma Accelerate: https://pris.ly/d/accelerate
- Use Driver Adapters: https://pris.ly/d/driver-adapters
Error: PrismaClient is not configured to run in Edge Runtime (Vercel Edge Functions, Vercel Edge Middleware, Next.js (Pages Router) Edge API Routes, Next.js (App Router) Edge Route Handlers or Next.js Middleware). In order to run Prisma Client on edge runtime, either:
- Use Prisma Accelerate: https://pris.ly/d/accelerate
- Use Driver Adapters: https://pris.ly/d/driver-adapters
But reading the docs I can't understand which adapter I should use for Supabase. Does anyone know how do I configure Prisma for supabase on Vercel?...