Search code examples
node.jsdatabaseherokudeploymentdirectory

How to exclude from delete folder during heroku deploy?


I deployed app on heroku which can save files with database record. Problem is, when i deploy again some changes, folder with files is new without files which were there before deploy (rows in database stay of course). How can resolve this? I want to folder "files" in root app folder stay this same during all future deploys on Heroku.

App - nodejs + express + react + postgresl


Solution

  • This is not possible, Heroku provides an ephemeral file system which is wiped out after each deployment.

    You need to persist data in a database (MongoDB Atlas, Heroku Postgres addon) or use an external file storage (AWS S3, Dropbox).

    Check out Files on Heroku to see some options and examples.