Search code examples
javascriptnode.jsherokuservercloud

Heroku application file upload - file is deleted after some time?


So I have made an node.js based application with file upload and everything works fine, I can upload files, browse uploaded files but after like 1 hour this file is I guess deleted from server? It's no longer available. So I have a question, is heroku deleting all non-application files after some time? Or what could be the reason of this?


Solution

  • Heroku file system is ephemeral so files are temporary and removed at every Dyno restart. It is likely that you have redeployed your application causing the restart of the Dyno.

    Heroku also restarts a Dyno at least every 24 hours. See Heroku documentation

    The good practise is to persist the files into an external storage (S3 for example). If you are interested in finding out which free options are available you can check this Git repo HerokuFiles