Repository navigation
Open
Labels
bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.topic: $transactionRelated to .$transaction(...) Client APItopic: generator-tstopic: interactiveTransactionstopic: queryCompilertopic: transaction
Description
Bug description
We're experiencing a spike in errors like this after migrating to the new prisma-client and driverAdapters:
Invalid `prisma.pageView.createMany()` invocation: Transaction API error: Unable to start a transaction in the given time.
It doesn't effect 99% of our requests but crashes those that do get this error. We were not experiencing this error with prisma-client-js.
Severity
🚨 Critical: Data loss, app crash, security issue
Reproduction
Do not have a stable reproduction.
Expected vs. Actual Behavior
No errors.
Frequency
Intermittent / Random
Does this occur in development or production?
Only in development (e.g., CLI tools, migrations, Prisma Studio)
Is this a regression?
Worked in 6.9.0, broken in 6.14.0.
Workaround
No workaround ATM.
Prisma Schema & Queries
model PageView {
id String @id @default(cuid())
userId String?
sessionId String?
pathName String
referrer String
timestamp DateTime
@@index([userId])
@@index([sessionId])
@@index([timestamp])
@@index([pathName])
} pageViews.push({
userId: typedPayload.user.userID,
sessionId: typedPayload.user.customIDs?.stableID,
pathName: typedPayload.metadata.pathname,
referrer: typedPayload.metadata.referrer,
timestamp: DateTime.fromMillis(typedPayload.timestamp).toJSDate(),
});
...
await prisma().pageView.createMany({
data: pageViews
});Prisma Config
No prisma config.
Logs & Debug Info
// Debug logs here
Environment & Setup
- OS: Debian
- Database: Postgres / Aurora Serverless RDS
- Node.js version: 22.18.0
Prisma Version
6.14.0
Reacted by Aleksandr, Aitaro Chaya, Supertiger, Roshan A., sosafe-robert-mcauley, Avi Romanoff, Dick Fickling, nickluger, Pedro Teixeira, Marcin Kwiek and 21 more
Metadata
Metadata
Assignees
Labels
bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.topic: $transactionRelated to .$transaction(...) Client APItopic: generator-tstopic: interactiveTransactionstopic: queryCompilertopic: transaction
Activity
[-]Spike in `Unable to start a transaction in the given time.` for new `sentry-client`[/-][+]Spike in `Unable to start a transaction in the given time.` for new `prisma-client`[/+]jkomyno commentedon Aug 29, 2025
Hi @iamnafets, can you please post your
generatoranddatasourceblocks from yourschema.prismafile, as well as the snippet you're currently using to initialize your PrismaClient instance?Also, does the same problem arise when using
prisma-clientwithoutdriverAdapters?Thanks.
nickluger commentedon Sep 7, 2025
Can confirm massive transaction timeout spikes (both, starting transactions and executing within timeout) since using the new adapters without Rust binary. Just reverted to previous setup, as not enough time to evaluate things currently.
Init:
iamnafets commentedon Sep 7, 2025
Sure thing!
The problem indeed happens regardless of whether we're using driver adapters, switched to driver adapters to see if we could fix the issue.
jkomyno commentedon Sep 8, 2025
So, to properly understand:
prisma-client, notprisma-client-js9.14.0This seems quite odd.
Can you please try again with the following configurations, and report back with the result?
[email protected]+prisma-client-js+previewFeatures = ["relationJoins"][email protected]+prisma-client+previewFeatures = ["relationJoins"]Can you also try again with Driver Adapters without specifying custom input parameters to
PrismaPg, besides the connection string?Thanks!
iamnafets commentedon Sep 8, 2025
I can confirm the issue persists without any custom parameters to the
PrismaPgadapter. I ran that before attempting to solve the problem with these parameters.Is there a sensible way for me to hook telemetry to these specific errors? I want to make sure I'm giving you something data-driven so I'd love to put a prometheus metric on these transaction-level events so I can track before and after.
Kila14 commentedon Sep 17, 2025
The same issue
prisma 6.16.2
19 remaining items
jacek-prisma commentedon Nov 12, 2025
Hi @iamnafets @yharaskrik @Kila14 @HubbardJacob @ozgurozalp @TaylorFacen @sosafe-robert-mcauley ,
We've released a fix that should resolve some cases of this error in version 6.18.0. Can you let us know if you're still seeing this issue on Prisma 6.18.0 or newer?
Thanks
egoldschmidt commentedon Nov 13, 2025
FWIW we are also seeing this in 6.18 / Node 24 (using the Rust-free engine + pg adapter)
sosafe-robert-mcauley commentedon Nov 14, 2025
I don't have load testing tools in my staging environment to test a potential fix for this issue, so I am hesitant to deploy a new version that may or may not fix the issue. I do not want to risk pushing to production and having another outage incident. I'll have to wait until others have tested and confirmed that it has been fixed before we try the new engine.
ihadabs commentedon Nov 30, 2025
We are also seeing this in 7.0.1 / Node 22 (Rust-free engine + pg adapter)
jsmircic commentedon Dec 2, 2025
maybe unrelated as we are using Azure SQL Db, but after migrating to 6.19 and "rust free" we get weird connection errors, after some time looks like connection pooler gets stuck and we see lots of:
errors.. Reverting back to rust engine for now.
Sriram-52 commentedon Dec 9, 2025
We attempted to implement the Rust-free upgrade in a staging environment for a client, but it proved to be entirely ineffective. The upgrade introduced numerous issues, including a persistent spike in database connections reaching approximately 170. This spike, coupled with slow read and write operations to the database, rendered the upgrade unusable. Consequently, we have decided to downgrade the system to version 6.5 for the time being.
arthur-ver commentedon Dec 21, 2025
Switching to the new rust-free engine with
@prisma/adapter-mssqlintroduced lots ofTransactionError: Can't rollback transaction. There is a request in progress.errors that weren't present with any Prisma version previously. Reverting back to rust engine as well for now.SylvainMarty commentedon Jan 16, 2026
I have seen similar issues with Prisma 7 and
@prisma/adapter-pgand had to rollback.After comparing the code changes in the new update, it looks like Prisma now handles the
maxWaitoption (2 seconds by default) differently when acquiring a new connection and starting a transaction.Both implementations rely on
setTimeout(), which is inherently non-deterministic and sensitive to Node.js event loop load. However, the behavior changed significantly:Promise.race.Under event loop pressure, the old implementation could allow
startTransaction()to resolve aftermaxWaitwas exceeded, simply because the timeout callback did not get CPU time beforeclearTimeout()was called. In practice, this meant timeouts were often missed.With the new implementation, the timeout is now part of the control flow and deterministically enforced. This likely explains why
maxWaittimeouts surface much more frequently under the same load: previously hidden pool starvation or backpressure is now made explicit.If this analysis is correct, one possible workaround is to increase the
maxWaitvalue. Prisma already supportsconnection_timeoutfor Postgres with a default of 5 seconds, which may also help Postgres users.This issue also seems related to #20015, which discusses how the default
maxWaiteffectively overridesconnection_timeoutandpool_timeoutsettings.Could someone confirm whether this interpretation matches the intended behavior change?
wthrajat commentedon Jan 31, 2026
Also getting this in
[email protected],node 24.13.0(the current LTS) (Rust-free engine + pg adapter)SupertigerDev commentedon May 6, 2026
any updates on this issue?
sosafe-robert-mcauley commentedon May 8, 2026
Chiming in - we have not updated from Prisma 6.19 as we wait for updates on this issue. Other teams in my company updated to Prisma 7, for lower-traffic services, with no issue, but for high-traffic services we are still avoiding the update.
If it helps any, a few more details on our setup that caused this issue:
const readWritePrisma = new PrismaClient({ datasources: { db: { url: readWriteUrl } } }); const readOnlyPrisma = new PrismaClient({ datasources: { db: { url: readOnlyUrl } } });)connection_limitof "10"pool_timeoutof "20000", but now that I cross-check Prisma docs, should this be "20" for "20 seconds"? (or better yet, set to "20s"?)max_connection_lifetimeof "300", which seems more lined up with Prisma docs (again though, should we specify explicit "300s"?)ssl_modeof "no-verify" (since RDS uses self-signed certs)Amit0-dev commentedon May 21, 2026
Hey, I'm using:
and I'm getting the same issue when hitting an API route that uses
$transaction().Error:
Normal Prisma queries work fine — the issue only happens with transactions.
I'm using Next.js App Router with a singleton Prisma client setup already in place.
Is this issue still active, or is there any recommended workaround/fix currently?
sosafe-robert-mcauley commentedon May 22, 2026
As far as the people who got hit by this the hardest and are holding out by continuing to use Prisma 6 can tell - it's still an issue, and there's no workaround, as raising the transaction maxWait has no effect.
Princedewangan101 commentedon May 30, 2026
const result = await prisma.$transaction(async (tx) => { // --------- }, { maxWait: 5000, timeout: 10000, })sosafe-robert-mcauley commentedon Aug 31, 2026
Those suggestions are already taken into account for the configuration I had @cekuu35 - we already had fairly significantly raised timeouts in Prisma as well as per-transaction as I noted in my above post #27990 (comment) . I've now since moved away from Prisma for query execution for my project thanks to
prisma-kysely, so unfortunately I won't be able to help now in testing possible solutions.