Skip to content
Discussion options

You must be logged in to vote

Hi @Aw3same 👋

Thank you for raising this question.

Prisma Client currently does not have built-in support for managing read and write replicas in a PostgreSQL cluster. In your current configuration, Prisma is using the DATABASE_URL environment variable to connect to the database. If this URL points to a read-only replica, you will not be able to perform write operations.

One possible workaround could be to manage the database connections at the application level. You could create two instances of PrismaClient, one for read operations and one for write operations, each with its own connection URL. Here's an example:

import { PrismaClient } from '@prisma/client'

const readClient = new Pris…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Aw3same
Comment options

Answer selected by Aw3same
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants