Search code examples
herokustrapi

Data does not persist when dyno is restarted in Heroku?


I have deployed Strapi headless CMS on Heroku free tier and tried to use it both with MongoDB and Postgres databases, whenever I restart the dyno e.g. during deployment - all the data created thus far is not persisted?

I tried rebuilding Strapi locally and I cannot reproduce the behaviour.

I am using free tier for hosting of Strapi as well as free tier of Heroku Postgres.


Solution

  • Most likely you created your project with --quickstart which is not Postgres, it is SQLite. Can you please check your config/environments/*/database.json files and ensure you have PostgreSQL setup?

    All model configs are stored in files meaning you will not be able to create, edit, or delete new models, fields, components while using Heroku. All data (content) is saved to the database.

    https://strapi.io/documentation/3.0.0-beta.x/guides/deployment.html#heroku