Herokus strapi instanced data wipe - strapi

I have created a Heroku Postgres db for my Strapi backend. The issue I have that any data stored in the db seems to be wiped out after 24hrs.
After 24hrs I have to connect to my db with new credentials, the data structure is intact, but the data itself is not persistent.
I have other strapi instances with v3 running on Heroku without this issue.
The current app is running on Strapiv4.02. Node v16.13.0. NPM v8.2.0.
What might the issue be?

In config vars, we have to set NODE_ENV to production.

Related

Strapi : why data got deleted every time i update strapi-app and deploy it on heroku

i've made strapi app for my backend and deployed it on Heroku
and it works fine
But when i update strapi app on local and then push it on heroku ,
previous data is deleted , and event admin username and pass is deleted
whay this happen ?
i though this data are on Postgres data base that i have made on heroku and should not be deleted
i found answer
i used postgres SQL and its work fine

Why do I lose contents of my database after a heroku dyno restart?

Anytime my app goes to sleep and comes back on, I lose data in my database
And I'm not storing any media, it's just form data (texts)... I built the app on strapi and I've followed all their guidelines but it keeps happening. I'd be happy if anyone can help
Local data (files, db) is cleared after a Dyno restart because the Heroku File System is ephemeral. A Dyno is restarted (at least) every 24hrs.
In your case Strapi uses SQLite where data is saved in a local file.
Strapi suggests to configure Postgres on Heroku, alternatively you can use an external DB storage service.
First of all:
As you create content types with strapi it generates the code (= new files) for the according controllers/routes/services
Heroku does not persist data after a restart
After a restart strapi checks which content types exist in the code and deletes the tables of nonexisting types from the database.
Therefore, on Heroku you have to set up all your content types locally and connect to an external db (e.g. Heroku Postgres) but never strapi's default textfile based db.
Then push the generated files and finally deploy.
Thus, on Heroku you should always run in production mode. This way the option to alter content types is completely blocked and you will not run into the issue of data loss after a restart.

Laravel cache store does not support tagging on production

I've set CACHE_DRIVER=redis locally and on production in my ENV file. Locally I can use tags and I see the tags and their values showing up in the Redis database.
However if I deploy to production I get cache store does not support tagging. My server is deployed through Forge so it should have Redis set up. I've been using it for a few weeks with Redis as cache driver so I'm surprise that it's throwing the error now.

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.
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

During the deployment Heroku automatically adds postgress Database

I have an application that I am trying to deploy to Heroku. I am facing an interesting situation, where a postgres database instance is getting created automatically without me provisioning one. In addition, env variable with DATABASE_URL is getting created automatically at the same time.
It is not a problem as for now, but later we would like to connect to existing DB. We are not able to modify config variable DATABASE_URL
Is there a way to disable automatic creation of Postgres DB

Resources