You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MySQL pool timeout using adapter (rust free engine) #28612
I wanted to switch instantly once I saw 7.0 is out, and I am consistently unable to connect to any database using the current 7 version. I receive a 'pool timeout error'. All Prisma operations (like schema creation) work fine, but the connection itself fails. I literally cannot access any data, but the typescript types and stuff works perfectly. I've ruled out environment issues by testing a blank project and by observing no incoming connections on the DB server. Downgrading to v6 immediately fixed the problem. This appears to be a bug in the latest release that needs fixing. Hope they will fix it soon. Until then I have to keep using v6.
If I remember correctly for me it was that I had to set ssl: false, allowPublicKeyRetrieval: true explicitly in the adapter config. Of course this is only true if you are not using SSL for the MySQL connection.
Also for debugging you can try to attach a logger instance to the adapter config like this:
I think what tripped me up was thinking the adapter should be using DATABASE_URL automatically. Also, I'm using mysql://... and it appears to work just fine this way with MariaDB too.
Sometimes the issue is that env vars should be getting set, but are not. I find it best to validate my env with Zod on start, so that if any of my expected env vars aren't getting set, my apps will crash right away.
Reacted by Ayoub Khemissi, André, Lorenzo Coronati and Nam Nguyen
I've hit a brick wall with this error—I’ve tried every possible solution under the sun, but nothing seems to make a difference. It's incredibly frustrating!
The core issue here is diagnostics: the mariadb driver attaches the real connection failure as a nested cause, but Prisma only surfaced the outer pool timeout message. As a result, users couldn’t see whether the problem was SSL/TLS, connectivity, or auth, which made these failures hard to diagnose:
pool timeout: failed to retrieve a connection from pool after 10000ms (pool connections: active=0 idle=0 limit=5)
However, the driver also includes a cause with the real reason, for example:
"RSA public key is not available client side. Either set option `cachingRsaPublicKey` to indicate public key path, or allow public key retrieval with option `allowPublicKeyRetrieval`" (in this case set allowPublicKeyRetrieval: true as @vpmedia mentioned)
or
"Connection timeout: failed to create socket after 1003ms" (increasing connectTimeout may help)
I opened a PR that passes the cause through so the underlying reason shows up directly in the Prisma error payload.
Reacted by Brad Christensen, Aidas Buivydas, mohammad norouuzi, Roham Goudarz and Chaos02
My password is URI-encoded in my .env file. I removed the encoding and typed it as asual, and it worked.
So now I have DATABASE_URL, which contains all connection info, with encoded password, and DATABASE_PASSWORD, which is not encoded...
Everything works completely fine after I ran npx prisma studio. Even when I stopped the studio, it still works. The error only occurs when I restart my device completely and ran the client again. Not sure if this applies to everyone here but this is what I've noticed when running the Prisma Studio
I ran into a similar issue as described in the initial bug description. I used the following code to print the error messages, and adding allowPublicKeyRetrieval: true, fixed the issue for me.
For me it says no matter what I do, that ESM is not supported. But when I modify my NestJS's config from CommonJS to anything else it breaks, and when I lookup what's up I always come to a documentation that states that NestJS can only be used if it's configured as CommonJS. I use NestJS version 10, and NodeJS version 22.
Or, if I follow prisma's documentation and include in the schema file that I want it to render CJS it just does not do that. It ignores that totally, and the ESM issue remains.
Update Prisma to latest version and fix MariaDB connection issues,
After updating Prisma CLI, @prisma/client, and the PrismaMariaDb adapter to the latest matching versions, I added the following connection options to resolve connection and SSL issues when connecting to MariaDB:
Activity
brenc commentedon Nov 21, 2025
Hit this myself. This is very confusing. It looks like you have to set the connection info w/ the adapter now:
The reason you're getting the error you're getting is because Prisma defaults to localhost. It's not using DATABASE_URL at all from the looks of it.
louiecodes commentedon Nov 23, 2025
I just migrated from Prisma v5 to v7 and also have same problem. I'm using @prisma/adapter-mariadb.
FelixBaum commentedon Nov 24, 2025
Just tried to set the connection info myself:
But unfortunately I'm getting the same error..
louiecodes commentedon Nov 24, 2025
I already tried same and still getting error.
I just downgraded Prisma to v6 with its respective configuration and works fine. Will continue using v6 as for now.
Kareszrk commentedon Nov 24, 2025
I wanted to switch instantly once I saw 7.0 is out, and I am consistently unable to connect to any database using the current 7 version. I receive a 'pool timeout error'. All Prisma operations (like schema creation) work fine, but the connection itself fails. I literally cannot access any data, but the typescript types and stuff works perfectly. I've ruled out environment issues by testing a blank project and by observing no incoming connections on the DB server. Downgrading to v6 immediately fixed the problem. This appears to be a bug in the latest release that needs fixing. Hope they will fix it soon. Until then I have to keep using v6.
Kareszrk commentedon Nov 24, 2025
I would like to point out the fact that this error also occures on node v22 and node v24 not just on v20 as mentioned in this issue.
treedots-kavan commentedon Nov 25, 2025
I also faced this issue
rivatove commentedon Nov 25, 2025
This error implies the connection with your DB fails to be estabilished. You need to debug the exact cause using the underlying
mariadblibrary.Common issues:
mysql://tomariadb://in the connection string.sslcert), you need to appropriately translate them into the object constructor.vpmedia commentedon Nov 25, 2025
If I remember correctly for me it was that I had to set
ssl: false, allowPublicKeyRetrieval: trueexplicitly in the adapter config. Of course this is only true if you are not using SSL for the MySQL connection.Also for debugging you can try to attach a logger instance to the adapter config like this:
Also you can try:
ref:
https://mariadb.com/docs/connectors/mariadb-connector-nodejs/node-js-connection-options
jcubic commentedon Nov 25, 2025
I have the same error. I've created a new Next.js project to reproduce #28627 now I can't even get to the stage when error appear.
Here is my project with a repro (for above):
https://github.com/jcubic/prisma-7-bug
Note that I can connect to MySQL using
mysqlcommand.brenc commentedon Nov 25, 2025
So it looks like you can do:
Or:
I think what tripped me up was thinking the adapter should be using DATABASE_URL automatically. Also, I'm using
mysql://...and it appears to work just fine this way with MariaDB too.Sometimes the issue is that env vars should be getting set, but are not. I find it best to validate my env with Zod on start, so that if any of my expected env vars aren't getting set, my apps will crash right away.
HamzaOutmassint commentedon Nov 25, 2025
I've hit a brick wall with this error—I’ve tried every possible solution under the sun, but nothing seems to make a difference. It's incredibly frustrating!
ayoub-khemissi commentedon Nov 25, 2025
This solution worked for me on MySQL 8.0 with the mariadb adapter. Seems weird because I thought you only had to put this in your .env file:
DATABASE_URL="mysql://user:password@localhost:3306/database"
Now I have:
DB_CONNECTION_LIMIT="5"
DB_HOST="localhost"
DB_PORT="3306"
DB_DATABASE="database"
DB_USER="user"
DB_PASSWORD="password"
And this inside my prisma.service.ts file:
jcubic commentedon Nov 25, 2025
I use
new URL()to parserprocess.env.DATABASE_URLIt seems that I parsed
/databasein my case, and this throw an error.So using this works fine:
19 remaining items
alireza-malek commentedon Dec 12, 2025
The core issue here is diagnostics: the mariadb driver attaches the real connection failure as a nested
cause, but Prisma only surfaced the outer pool timeout message. As a result, users couldn’t see whether the problem was SSL/TLS, connectivity, or auth, which made these failures hard to diagnose:However, the driver also includes a
causewith the real reason, for example:or
I opened a PR that passes the
causethrough so the underlying reason shows up directly in the Prisma error payload.feat(adapter-mariadb): Improve MariaDB adapter error reporting by sur…
feat(adapter-mariadb): Improve MariaDB adapter error reporting by sur…
Pouet-- commentedon Dec 18, 2025
The code from @yc-w-cn helped me to know what was the error :
My password is URI-encoded in my .env file. I removed the encoding and typed it as asual, and it worked.
So now I have DATABASE_URL, which contains all connection info, with encoded password, and DATABASE_PASSWORD, which is not encoded...
pjhi commentedon Dec 18, 2025
Exactly the same here under macos
malith-senevirathna commentedon Dec 22, 2025
These configs fixed the problem. Thanks @alireza-malek.
rtussing commentedon Jan 13, 2026
I ran into a similar issue as described in the initial bug description. I used the following code to print the error messages, and adding
allowPublicKeyRetrieval: true,fixed the issue for me.dmnq2000 commentedon Jan 23, 2026
I'm using [email protected] with [email protected] on [email protected]. Just add
import 'dotenv/config';then it works.Kareszrk commentedon Jan 23, 2026
For me it says no matter what I do, that ESM is not supported. But when I modify my NestJS's config from CommonJS to anything else it breaks, and when I lookup what's up I always come to a documentation that states that NestJS can only be used if it's configured as CommonJS. I use NestJS version 10, and NodeJS version 22.
Kareszrk commentedon Jan 23, 2026
Or, if I follow prisma's documentation and include in the schema file that I want it to render CJS it just does not do that. It ignores that totally, and the ESM issue remains.
HrOice commentedon Feb 10, 2026
I found problems in process.env when I print it with "console.log(process.env)"
shows like:
then I export them without double quotes, it works...
Vaibhav-Vanjani commentedon Mar 6, 2026
This works:❤️
Update Prisma to latest version and fix MariaDB connection issues,
After updating Prisma CLI, @prisma/client, and the PrismaMariaDb adapter to the latest matching versions, I added the following connection options to resolve connection and SSL issues when connecting to MariaDB:
allowPublicKeyRetrieval: true,
ssl: {
rejectUnauthorized: false
},
connectTimeout: 10000
fix: prisma
fix(db): resolve MySQL 9 pool timeout with mariadb adapter