Strapi digital ocean app platform not loading/saving data on db

System Information
  • Strapi Version: 4.1.3
  • Operating System: Windows
  • Database: postgres
  • Node Version: 16.13.2
  • NPM Version: 8.4.1
  • Yarn Version: 1.22.15

After each deployment to digital ocean app platform I need to create a new admin user to login to strapi and all the data I entered in the previous deployment is gone.
In my digital ocean app I have a web service component holding the strapi build and a db component with the database (postgres).

I have the database configuration in env > production > database.js file like so:

and in the app env variables I’ve put the DATABASE_URL=${db.DATABASE_URL} key.

I don’t know how to make the data to stay after each deploy, is it because the database is not connected properly to the strapi app? or maybe it is just impossible to use strapi in app platform??

PLEASE HELPPPP
thanks!

@Tal_Shemer, its probably because your database config file is not following the Strapi v4 format. You should have something like this:

const parse = require("pg-connection-string").parse;
const config = parse(process.env.DATABASE_URL);

const { host, port, database, user, password } = parse(process.env.DATABASE_URL);
module.exports = () => ({
  connection: {
    client: "postgres",
    connection: {
      host,
      port,
      database,
      user,
      password,
      ssl: {
        rejectUnauthorized: false,
      },
    },
    debug: false,
  },
});

But also be aware that DATABASE_URL env var causes potentially an issue. Please refer to this post: Getting strapi working on digitalocean app plattform - #2 by tw1t611

Let me know if this works out for you (cause for me its not haha)

finally its working for me as well. its just i forgot to add a env folder in config for production, so he was still trying to use sqlite in prod. Lost a few hours with this :man_facepalming: