Prisma

P

Prisma

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

Join

Delay when navigating between pages

Delay when navigating between pages using next/link despite utilizing loading.js, caching for fetch, or even static pages.

Problem with Stream on Pulse

GM, It was working in the past then we got some problem with NeonDB that have been fixed by Neon themselve Currently I'm unable to use stream() and it look like we don't have any event stored, we have activated event persistance like in the past ...
No description

rawQuery compilation

After switching from mssql to Prisma ORM, I noticed that the rawQuery calls are much slower than they were on mssql. Do they get precompiled and cached and if not, is there any way to? I have a pretty big query that takes about 520ms to complete while it used to be about 20ms. I also cannot use TypedSQL as I'm using SQL Server as database....
Solution:
Hey @PlanetTeamSpeak πŸ‘‹ There is some overhead involved even while using Raw Queries with Prisma as raw queries still need to be processed via the query engines, so at the moment it won't be as fast as a native mssql driver. We are working on a new prototype which should make queries alot faster. I don't have a timeline yet which I can share with you....

TypeError: The "payload" argument must be of type object. Received null

There's an ongoing issue in our codebase where Prisma queries that fail give the error in the title, which isn't the typical error we see in other projects. Our project is using NextJS 15.0.2 and Prisma (with neon serverless adapter) 5.22.0. Here is the client: `import { Pool } from "@neondatabase/serverless";...

Migrations hang on Prisma Postgres

Hi, out of seemingly no where, I can no longer migrate the DB. When I run the command I get this ```bash $ bunx prisma migrate dev --name updateembeds Environment variables loaded from .env Prisma schema loaded from prisma\schema.prisma...

nextjs + prisma: rawQuery breaking if using globalThis

Hi! I'm currently working on a nextjs (14.x) project, where I also want to use prisma (5.22). I have encountered an issue with nextjs always generating new clients in dev mode, so I followed the documentation and only generate the client, if it does not yet exist on globalThis. This seems to work when I use the client directly, but rawQueries only work on the first rendered route. As soon as a route has to be re-rendered (which happens very often in dev mode), the parameters no longer get properly resolved. Here is a simple example, queried with a freshly created client:...
Solution:
its a bit different, as I need multiple client instances due to a multi tenant setup. ```js import { PrismaClient as PrismaClientTenant } from './client' ...

FindUnique/Update using unique index on sub field

Hi, I need some help with generating a schema where I can query indexed sub fields. I've looked for solutions but I couldn't really find a thread matching my problem. Let me sketch an example. (I'm working with Prisma ORM with MongoDB)...
Solution:
Hi Raphael, Thanks for your fast reply. I've tinkered with this some more and found out it actually can be done. However the subfield should have a name that is not inside the model. ...

Concurrent request (Prisma)

Hello, I have a problem with Prisma on PostgreSQL. I don't know how to fix it
Context...

TypedSQL for SQL Server?

Are there any plans of adding support for SQL Server in TypedSQL? Seems like it wasn't even mentioned in the announcement nor was its lack of support mentioned. Only found out when I tried to use it.
Solution:
Hello @PlanetTeamSpeak πŸ‘‹ We do have a feature request for adding support of SQL server for TypedSQL here: https://github.com/prisma/prisma/issues/25215 ...

Connecting to MySQL server in production.

Hosted by DreamHost, my MySQL server in phpmyadmin cannot be connected by my NextJS application on DigitalOcean's app platform. I am faced with this error:
Error querying the database: Unknown authentication plugin `sha256_password'.
Error querying the database: Unknown authentication plugin `sha256_password'.
However, in localhost, it connects to the database perfectly. The environment variables are exactly the same....

Two Schemas but only one will stay generated at a time

Title is pretty explanatory. I have two schemas for different databases but I can run generate for one schema and then the other schema starts to have error lines in vscode, then generating the other schema swaps the errors to the first schema. Any way to fix this it’s pretty annoying.

Broken JsDoc on prisma Upgrade from 4 to 5.22

I just upgraded the Prisma version from 4 to 5.22 and noticed that my IDE no longer recognizes some typedefs I was using. I used to create a Typedef file to use the Prisma types in JSdoc. - Prisma version: 5.22 - NodeJs 20...

Optimize not showing recommendations for a finished recording (+ feature requests)

I've just started using Prisma Optimize and wanted to flag one bug and a couple of feature requests. 1. I'm not seeing any recommendations for either of the finished recordings 2. It would be super helpful to be able to sort the queries/groups tables by the columns, otherwise it's very inefficient to go through it to identify slowest ones (this might be less pressing depending on what the recommendations tab looks like when working. 3. Ability to name recordings would help to organize things...
No description

Best way to look for text in a deeply nested JSON?

I have a JSON field in a table. Which holds the metadata for the row. So what will be in the JSON is kind of unpredictable. Because it'll store tiptap editor json, other json etc., Here are the few examples Example 1:...
Solution:
Okay, I did this. `` const postsWithMeta = await db.$queryRaw<Posts[]> SELECT p.* FROM "Posts" p...

Raw SQL returns ~5x slower than CLI / `pg` package

I have a query that returns 170k rows of two 4-byte integer (so ~1.5MB total). When I run this on the CLI (pgsql), I get a ~500ms runtime. Using queryRawUnsafe or queryRaw. the query is 2-3 secs. I even hooked up the pg package and confirmed it is around ~500ms....

Infer type from create query?

here's the function that creates a new Schedule. Attention to the shape, not data ```ts async function createSchedule() { return db.schedule.create({ data: {...

Tracing / OTEL only works with manual active spans.

I have just spent a few hours pulling my hair out to no avail. I tried to boil things down simply: Ths code does not submit any traces to the console nor Jaeger UI: ```import { OTLPTraceExporter } from " // Configure the trace provider...

Dynamic Database Name Support in Studio

I’m facing a recurring issue during development that forces me to duplicate projects just to manage different .env files. Let me explain the scenario: Currently, I’m working on a project with a MASTER database that handles tenant access and several TENANT_###### databases, each specific to a client. Here’s the workflow:...

Is there no more online database browser from prisma?

I remember a while back cloud.prisma.io had a visual database browser that one of my projects really dependended on, now it doesn't seem to exist anymore. What can I do about this?

narrow down String type using prisma client's extension?

can I explain to prisma client and typescript that this particular field needs to be a string union? ```ts model Lesson { id Int @id @default(autoincrement()) type String? // null | "practical" | "seminar" | "lecture"...