Prisma

P

Prisma

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

Join

Help Needed: Error with Postgres Schema, OpenAI Embedding and Prisma

I'm currently working on saving OpenAI embeddings in a Postgres schema, and I'm encountering a TypeScript error. Below is the schema I'm using: model SentenceEmbedding { id String @id @default(cuid()) voiceNoteId String voiceNote VoiceNote @relation(fields: [voiceNoteId], references: [id], onDelete: Cascade)...
No description

How to extends the client for adding soft delete features currently this is not working how to fix ?

import { Injectable, OnModuleDestroy, OnModuleInit } from '@nestjs/common'; import { PrismaClient } from '@prisma/client'; import { prismaExtendedClient } from './extension'; @Injectable()...

How to do operations on multiple columns

Hi, let's say I have the following table structure: A | B | C which are all ints I would like to be able to find all rows such that a*a + b - 30 = c I assume I would start like this:...

Problem fetching relations where where-clause have same field name

I want to fetch a User object by username with all relevant followers and their user objects. Just one level, something like: { name, email, username,...

Unexpected message from server

Hi all, we see this error pretty randomly
error in connector: error querying the database: unexpected message from server
I try to replicate with the same query, but the error persists. Is this the kind of error wherein it makes sense to implement some kind of retry logic?...

NextJS + Prisma + Docker | "can't reach db server"

I will supply all of my files in comments because of the character limit. The first issue is that when I run my docker compose up, it generates the prisma client, then it runs npm build. On the build, it cannot connect to the database server (shown on the included image) For context, I am using this as a reference: https://github.com/99lalo/nextjs-prisma-docker...
No description

Able to setup Accelerate, unable to setup Pulse. AWS RDS Postgres.

The error : "Prisma Pulse could not reach the specified datasource db url. This could be caused by an incorrect datasource URL or database firewall rules, or certificate issues. This is probably not a problem with Prisma Pulse. The network error was: "Postgres client.connect() is unresponsive." With the connection string, I can connect using other pgTools from my own computer. My Prisma ORM is using the same connection string and is able to function with Accelerate. I have followed the instructions in (https://www.prisma.io/docs/pulse/database-setup/aws-rds) and set the rds.logical_replication to 1 (true)....
No description

Why does this function not work?

I'm trying to create a prisma file (/lib/db.ts) to initialize from anywhere in my code when I need it. Why does $disccount and $use not work and how do i get it to work if it is necessary. Here is code: ```import { PrismaClient, Prisma } from '@prisma/client'...
No description

Accelerate On-Demand Invalidation Rate Limit

What's the rate limit for programatic/on-demand cache invalidation? I can't find any details in the documentation

Tool to write schema by hand

Greetings everyone, I have a quite weird question, does a specific tool exist which i can use to write my prisma schema manually, because i feel too dumb to write my schema manually for my mongodb instance. Thanks...

Records found that don't exist (Supabase + Prisma)

I've got a very wierd bug I can't figure out. I've deleted all my records in Supabase for table upvote, but I am somehow able to find a non-existant record and delete it! When adding an upvote, I'm checking for a record. If one exists already, I delete it, if not I create one. Even after clearing the table, it is able to find an existing record and try to delete it (even with a success message) although no record should even exist....
No description

Correct way to setup prisma + docker

(I am new to prisma this is my first project using it) Hi I am currently trying to dockerise one of my typescript apps (discord bot) which is using prisma with sqlite database. I am in the middle of writing the dockerfile This is it so far: ``` FROM node:18-alpine ...

Error validating datasource URL must start with the protocol prisma://

Hello, I'm having this issue when deploying my Next application to Vercel. Everything works fine locally. I have triple-checked env variables on Vercel and they're the same as my env locally. I also get this error if I build the project and run prod environment locally without deploying to Vercel. Any idea what might cause this; and how to solve it?...
No description

TypeError: client._engine.apiKey is not a function

node_modules/@prisma/extension-accelerate/dist/cjs/extension.js:81:40
node_modules/@prisma/extension-accelerate/dist/cjs/extension.js:81:40
I'm having trouble starting my prisma client locally, do I need to login or something?...

AWS SAM + Lambda not bundling properly.

Hi guys. I'm writing an AWS SAM template in which I am setting up Prisma with my Lambda functions to interact with my RDS Postgres DB. I am facing an error that I suspect might be related to the query engine and prisma.schema not being bundled with the code. The error I am getting is: ``` Prisma Client could not locate the Query Engine for runtime "rhel-openssl-3.0.x". ...

`The Query did not produce a result within the maximum allowed execution time of 10 seconds.`

For a while now we're occasionally getting said error while building our app in GitHub Actions, connecting via Accelerate to MongoDB. The weird thing is, that said collection is basically empty (10 documents) and its documents are tiny. There is no plausible reason that makes this occasionally fail. Can you check what is going on there? We tried adding a cacheStrategy hoping to mitigate this somehow - to no avail. Can you check this request-id for some more detailed logs? 8cb4413f8e688d90
No description

dev.db-journal is always created

Could you create a simple dummy project and install Prisma using SQLite ? Does it also always, even with the simplest model, create an dev.db-journal file for you ? I read that this file is a rollback journal file and should only be present temporary during a transaction....

introspecting never loading

Hi, I have a freshly setup project and db with a couple simple tables in it, and when I pull my db with prisma, I just infinitely load on introspecting based on datasource defined in prisma/schema.prisma. How do I fix this and get past this? I made sure the configuration and DB url is correct. I am using supabase for a db
Solution:
I actually made a mistake, I needed direct URL and everything is working great! New to prisma so unaware of it.

JSON Filtering on object key value inside array example from doc doesn't work

model Test { id String @id @default(uuid()) @db.Uuid data Json }
await db.Test.create({data: {data: [{petName:"Claudine"}, {petName: "Sunny"}]}})...

.update return null when data is found using .findUnique using the same where clause (version 5.17.

How is this even possible ? my updatedUser is null, and no updated has been performed But the data exist since the user is found successfully no error is thrown by prisma just updatedUser being null...