Reputation: 3
My Discord bot has a level system that requires it to write to a JSON file.
I am hosting it on Heroku and it's currently not updating the file. I know Heroku cannot save data, so is there a way I can code it to write to the file on my computer?
I followed Tech With Tim's tutorial on how to host.
Upvotes: 0
Views: 535
Reputation: 13983
Heroku filesystem is ephemeral so every change is lost after the redeployment/restart of the Dyno.
Your options are to use a database or an external file storage, which is probably what you want as you need to save a JSON file.
Heroku cannot access your computer over the network (unless you tunnel the requests using ngrok, that is possible but not very practical).
You can save the file to a remote storage service (like Amazon S3) or integrate with some other cloud service (Google docs using Google Drive API).
Upvotes: 1