Strapi Deploy Fails on Render: Unable to acquire a connection to PostgreSQL

Hello everyone,

I’m trying to deploy a Strapi v4 application to Render, connecting to a Render PostgreSQL database. My deploys consistently fail with the error Unable to acquire a connection. I’ve tried numerous troubleshooting steps, but the issue persists.

My Strapi web service fails to deploy with the following error message in the Render logs, indicating a database connection issue:

[2025-06-13 14:05:15.732] error: Unable to acquire a connection Error: Unable to acquire a connection at Client_PG.acquireConnection (/opt/render/project/src/blog/node_modules/knex/lib/client.js:311:13) at Runner.ensureConnection (/opt/render/project/src/blog/node_modules/knex/lib/execution/runner.js:305:46) at Runner.run (/opt/render/project/src/blog/node_modules/knex/lib/execution/runner.js:30:30) at Target.then (/opt/render/project/src/blog/node_modules/knex/lib/builder-interface-augmenter.js:24:43) [2025-06-13 14:05:15.733] info: Shutting down Strapi

The Build phase is always successful, meaning npm install and strapi build complete without errors. The Unable to acquire a connection error occurs when Strapi attempts to start up and connect to the database.

This is my setup
Strapi Version: 5.11.0
Database: Render PostgreSQL
Deployment Platform:Render (Web Service)
Repository: https://github.com/tomasmillan/Portfolio-2.0

And this is my database.ts code
import { parse } from ‘pg-connection-string’;

export default ({ env }) => {
const config = parse(env(‘DATABASE_URL’) as string);

return {
connection: {
client: ‘postgres’,
host: config.host,
port: config.port,
database: config.database,
user: config.user,
password: config.password,
ssl: {
rejectUnauthorized: false
},
pool: {
min: 2,
max: 10
},
},
};
};

Given that the build is successful and I’ve exhausted common troubleshooting steps related to the database URL, SSL, pooling, and version compatibility, what else could be causing this persistent Unable to acquire a connection error on Render? Are there any less common configurations or environmental factors I might be missing?

Any insights or suggestions would be greatly appreciated!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.