admin管理员组

文章数量:1339483

I have created a node app with local persistent storage in a .json file. It works fine running locally, but when I deploy it to heroku the persistent storage is modified, but then erased.

I have created a node app with local persistent storage in a .json file. It works fine running locally, but when I deploy it to heroku the persistent storage is modified, but then erased.

Share Improve this question edited Mar 14, 2017 at 0:04 Someone asked Mar 13, 2017 at 23:44 SomeoneSomeone 8722 gold badges8 silver badges27 bronze badges 1
  • What kind of local persistence? If you mean on the server then yes. That's how Heroku works, you need to install an addin – Paul Commented Mar 13, 2017 at 23:47
Add a ment  | 

2 Answers 2

Reset to default 13

Heroku does not provide any sort of persistent storage on dynos. If you need to persist files across sessions, you must use object storage such as Amazon S3.

https://devcenter.heroku./articles/dynos#ephemeral-filesystem

You can also setup Active Storage using Amazon S3 as @Max Woolf's explanation stated, but you can also store in a persistent instance of a relational database like postgres or Amazon RDS, which would be available on heroku as a plugin instead of using a json file.

本文标签: javascriptHeroku local persistent storageStack Overflow