Data Deletion Issue in Strapi Cloud

Hello Support Team,

I recently switched from using a self-hosted Strapi JavaScript version to Strapi Cloud. When I was transferring data, I faced some problems because of the integrity checks, but it was resolved by bypassing the checks in Strapi Core.

Currently, I’m experiencing an issue where every time I make changes to Git and redeploy Strapi to the cloud, it deletes all the data. I’m not using any database configuration on Strapi Cloud, and I’d like to know if this is expected behavior.

Moreover, I’d like to know if it’s possible to use an external database or keep the data after each deployment. If there’s a solution to this problem, please let me know.

Thanks for your help.

Best regards,
Gurpreet Singh Dhillwan

By default, it should create a PostgreSQL Database which will retain data. However, if you somehow managed to set up an SQLite database, that would be the expected behaviour.

I’m not a Strapi Cloud user by the way, this is my experience with self-hosted.

1 Like

How does your database.js file look like. Do you have multiple ones in config/env/X etc ?

What @dallasclark said is correct btw

Thanks for the response,

here is a preview on my database.js file (Javascript Strapi)

module.exports = ({ env }) => ({
  connection: {
    client: "mysql",
    connection: {
      socketPath: `/cloudsql/${env("DATABASE_SOCKET_PATH")}`,
      database: env("CLOUD_DATABASE_NAME"),
      user: env("CLOUD_DATABASE_USERNAME"),
      password: env("CLOUD_DATABASE_PASSWORD"),
      ssl: env.bool("DATABASE_SSL", false),
      max: env.int("DATABASE_POOL_MAX", 100),
    },
    debug: false,
  },
});

Environment Variables are in place as well on strapi cloud. Sql is hosted on GCP Insance.

Do you have any other database.js files ?
Like one for development and one for production or are you sharing the same file ?

No this is the only file that use for development and production.

I’m not sure where Strapi Cloud is hosted but you would benefit heavily by keeping the database as close to the service as possible for performance reasons.


When you say the data is deleted, is it everything like a fresh Strapi installation or is it some content-type data only?

Can you provide some details from your logs with your database debug set to true?

When I rebuild the project, it is likely that the Strapi instance is completely reset to its default state, which includes deleting all data and resetting to the initial state of the application (i.e. fresh Strapi installation).

No I only use one file for it, somehow strapi is not picking up the sql database configurations which I defined in database.js, instead it is storing all schema/data into sqlite, which results in deleting data

Never share development and production database.
If you change the schema in development you theoretically rename and or delete the data in production.

Better practice then to use this

Where you can say in development use database X and in production use database Y

So you separate the environment with two separate files.

Okay, I have another question. Does Strapi Cloud support MySQL? I noticed that the prerequisites list on the Strapi Cloud - Your Headless CMS Managed for You page only mentions PostgreSQL as a supported database

Currently it’s Postgres we are expanding with new databases etc later date, but no confirmed date

thanks for the reply. I am still having an issues with external Postgres in Strapi Cloud: Strapi Cloud Deployment Error - Connection Issue with Postgres on GCP