Prisma

P

Prisma

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

Join

PrismaClient is not configured to run in Vercel Edge Functions or Edge Middleware

I created a next.js (14.2.3) app and followed Auth.js documentation to add Goole OAUTH and prisma database (schema successfully initiated), now when I click "Sign In with Google" I see the following error in console: ```TXT [auth][error] AdapterError: Read more at https://errors.authjs.dev#adaptererror [auth][cause]: Error: PrismaClient is not configured to run in Vercel Edge Functions or Edge Middleware. In order to run Prisma Client on edge runtime, either:...

How to manage shared Prisma types in serverless frontend/backend apps

Hi! What are the best practices for using Prisma with a serverless architecture? I've already read docs on deployment, my question is more around development workflow of generating types since i'm using TS. I'm using Prisma Client exclusively on the backend, but I'd like to be able to access the generated types on the front end. Should I use a top-level shared-types directory / package that uses Data Transfer Objects? or is there a better way?

Prisma with Accelerate TypeScript error

When I'm using Prisma with Accelerate, the Prisma types are not generated for the Accelerate extension. Trying to use cacheStrategy results in TS showing the following error:
Type '{ ttl: number; }' is not assignable to type 'never'.ts(2322)
Type '{ ttl: number; }' is not assignable to type 'never'.ts(2322)
...

prisma db push is failing on relation

Hello 👋, when trying to apply a new SQLite schema it throws this error complaining something is wrong with the relation. I hope someone experienced can help me, thanks for taking your time! Error: SQLite database error near "(": syntax error in CREATE TABLE "sessions" ( "session_token" TEXT NOT NULL,...

ERROR: column "filename" of relation "ActionDependencyList" contains null values

Sorry for the noob question but I am a bit confused what should I do after this error. Can someone help me please? ```bash npx prisma migrate dev  ✔  16s   22:16:18  Environment variables loaded from .env Prisma schema loaded from prisma/schema.prisma...

Change query typing to respect where null, or where not null

Hello! I am wondering if there is a solution for my current case that would greatly improve my code. I have several tables that have 2 states: in reservation, or not in reservation. When a row is in reservation, it does not have the links (or relationships) to other tables as it does when not in reservation. For this reason, multiple relationship must be nullable, see screenshot for an example. I would love to be able to do something like this:...
No description

Self-Hosted Pulse?

Is there any way to use pulse so it's contained within my own cloud environment? Making my database publicly accessible is a bad idea for any application, however we are handling PHI and need to be compliant with certain regulations, so that is not an option.

How to filter if a variable is not in database

Hi, I am fetching users like: ``` const users = await prisma.users.findMany({ where: { accountStatus: status as accountStatus,...

No index found for fulltext search over relation (Planetscale)

I'm trying to find "favorited companions" combined with the ability to search through them. As you can see in my code, I search inside a relation query. But I get an error that no index could be found. Is this not possible with Planetscale?...

How to order multiple index

I have a index with multiple fields, i want to order them by company_id at first, but when i'm looking at my BD, it doesn't appear in first index : ```js @@index([company_id, CATEGORY_FINAL, GROUP_MATRIX_GROUP, TOP_PRODUCT, NRICHER_PRIO_COMPETITOR, BRAND, GROUP_CONCURRENT, MODEL, E_TRUSTED, likeStatus], name: "idx_pricing_company_id") @@map("pricings")...

user not saving on mongodb but works fine with mysql

hi , i was using mysql and switched to test mongodb , followed the docs on mongodb and my User model looks as follow now : ```ts enum Role { USER...
Solution:
issue was with Prisma needs to perform transactions, which requires your MongoDB server to be run as a replica set configured my mongo and it worked fine...

Using createManyAndReturn

Hi! I'm using Prisma with SQLite, and the LibSQL adapter, and I've just updated to the latest version. I see in the docs that I should have access to createManyAndReturn since I am using SQLite, but it does not appear to be an option in my editor. Would the LibSQL adapter prevent me from being able to use it?

Prisma custom flow

Hello we are trying to make something like our prisma flow like we want to controll when something happend like we want to controll when generate client and when creating migrations etc... It is possible to do it? Thanks...

Prisma RLS using transactions

Hey guys, I hope to get some help here 🙂 I want to implement RLS using a prisma client extension (as explained here https://github.com/prisma/prisma-client-extensions/tree/main/row-level-security).  This works as expected for the cases where I only query some data without using transactions. However if I use sequential transactions ($transaction([])) it seems to be that only the "outer" transaction (the transaction inside the client extension which intercepts my queries in order to set the RLS parameter) is called but not the "inner" transactions which should be called right after setting the RLS parameter. I don't use interactive transactions and my prisma client version is 5.12.1. Has anyone ever had similar problems?...

Typing custom property on a method

I want to add a custom property to a findMany on a particular model to ensure that the user has access to the returned resources (passing in authorizeUser which has { read: [...ids] } which is used to filter the returned resources. I am following: https://www.prisma.io/docs/orm/prisma-client/client-extensions/type-utilities#add-a-custom-property-to-a-method I have the query set up and working correctly, but am unsure how to add the types for a particular model, rather than the generic $allModels. Can someone point me to an example for a single model?...

Prisma 5.12.1 client has errors accessing postgress db when using with cloudflare workers and the ne

Prisma 5.12.1 client has errors accessing postgress db when using with cloudflare workers and the new { previewFeatures = ["driverAdapters"] }. All queries using the PrismaClient() will fail with error: Cannot find module './query_engine_bg.js' the issue is noted here: https://github.com/prisma/prisma/issues/23855...

`PrismaClientInitializationError: Prisma Client could not locate the Query Engine for runtime` error

I'm having an error when trying to bundle my application with ts up ``` PrismaClientInitializationError: Prisma Client could not locate the Query Engine for runtime "darwin-arm64". ...

Foreign key constraint failed on the field: `anime_season_fkey (index)`

Getting this error when I try to create a new db entry in prisma, no clue why. Using Postgres rismaClientKnownRequestError: Invalid prisma.anime.create() invocation: ...
No description

Delete Prisma Models

Models.py deosn't have the added migration even though its in the migrations folder and was applied to database, how do I just re-gen models.py