Strapi v.4 deployment

Hello.
I wanted to ask if there is anyone who has managed to install strapi version 4 in render, using a Postgres disk and database.
I’ve been stuck with this problem for weeks and can’t find the solution.

I have followed the configuration guide that strapi gives for version 4 but I think it is incomplete. I have also followed the Render installation guide for version 3 making some modifications and it always returns the following: error: connect ECONNREFUSED 127.0.0.1:5432
I have a feeling that the new strapi structure has changed a lot and the solutions for version 3 are not as compatible with version 4.

In local everything works perfectly, but in production I can’t solve the problem.

Hi @Bipolab-eu,

I spent some time looking at the Strapi docs and how the config was updated for some providers for v4. Can you try updating your config/env/production/database.js to the following?

const { parse } = require("pg-connection-string");

module.exports = ({ env }) => {
  const { host, port, database, user, password } = parse(env("DATABASE_URL"));

  return {
    defaultConnection: "default",
    connection: {
      client: "postgres",
      connection: {
        host,
        port,
        database,
        user,
        password,
      },
    },
  };
};

Let me know if this helps you get past the ECONNREFUSED error!

Thank you so much Jade!!
Have a happy new Year! :slightly_smiling_face:

1 Like