Report this

What is the reason for this report?

Hi, hope someone can help me. Im trying to deploy my strapi app but I keep getting the same error. 08:25:43] (node:27) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead. [backend-manueloroscohome] [2025-01-20 08:25:43] (Use node --trace-deprecation ... to show where the warning was created) [backend-manueloroscohome] [2025-01-20 08:25:44] [2025-01-20 08:25:44.711] error: self-signed certificate in certificate chain [backend-manueloroscohome] [2025-01-20 08:25:44] Error: self-signed certificate in certificate chain [backend-manueloroscohome] [2025-01-20 08:25:44] at TLSSocket.onConnectSecure (node:_tls_wrap:1679:34) [backend-manueloroscohome] [2025-01-20 08:25:44] at TLSSocket.emit (node:events:520:28) [backend-manueloroscohome] [2025-01-20 08:25:44] at TLSSocket.emit (node:domain:488:12) [backend-manueloroscohome] [2025-01-20 08:25:44] at TLSSocket._finishInit (node:_tls_wrap:1078:8) [backend-manueloroscohome] [2025-01-20 08:25:44] at ssl.onhandshakedone (node:_tls_wrap:864:12)

this is my config/env/databse.ts file module.exports = ({ env }) => ({ connection: { client: ‘postgres’, connection: { connectionString: env(‘DATABASE_URL’), ssl: env.bool(‘DATABASE_SSL’, false) && { ca: env(‘DATABASE_CA’) ? env(‘DATABASE_CA’).toString() : undefined, rejectUnauthorized: env.bool(‘DATABASE_SSL_REJECT_UNAUTHORIZED’, false), }, }, pool: { min: env.int(‘DATABASE_POOL_MIN’, 2), max: env.int(‘DATABASE_POOL_MAX’, 10) }, debug: false, }, });

Im still getting the same error. enc variables are

App-Level Variables

APP_URL=${APP_URL} NODE_ENV=production DATABASE_CA=${db-name.CA_CERT} DATABASE_SSL_REJECT_UNAUTHORIZED=false DATABASE_POOL_MIN=2 DATABASE_POOL_MAX=10 DATABASE_SSL=false



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Heya,

The error self-signed certificate in certificate chain occurs because Strapi (or Node.js) is trying to validate a certificate, but it does not trust the self-signed certificate in the chain. This is related to how your app is connecting to your managed PostgreSQL database. Let’s address this step by step. What I can see on a first glance are a couple of things

  1. SSL Configuration:

    • The ssl configuration is not properly aligned. If your database uses SSL but has a self-signed certificate, you need to set rejectUnauthorized: false explicitly and handle the certificate correctly.
  2. Environment Variables:

    • DATABASE_CA seems to point to ${db-name.CA_CERT}. If it’s not correctly defined in your App Platform settings, it might be causing issues.
  3. Strapi Database Configuration:

    • The logic in your database.ts file may not correctly handle SSL when DATABASE_SSL is false.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.