The public/uploads folder from your git repo isn’t the same location as your disk mounted at /public/uploads. Your git public/uploads full path will be /opt/render/project/src/public/uploads (the relative path from where your service executes is public/uploads). Your service will either need to access images from both locations or you need to merge these two locations. At runtime, any images a user of your service uploads should be written to your disk at /public/uploads. If you want to use a single location for uploads, it should be your disk. To merge the contents of public/uploads your disk you can run a rsync when your service boots by changing your start command to rsync -a public/uploads/ /public/uploads && node src/index.js
Your request (50297) has been updated. To add additional comments, reply to this email.
In your case an rsync wouldn’t be applicable. The start command runs on a new deploy, so any files uploaded would have been lost before that command gets to run, so you’re syncing an empty /opt/render/project/src/public/uploads with your disk /public/uploads
You need to update your code to be write the file uploads to the disk mount path /public/uploads
Yes, it is correct that you should be writing any files uploaded to your disk during runtime.
The purpose of the rsync is to sync any files you commit to git and push to Render when you deploy your service. If you will never do this, then it isn’t needed. This means during runtime of your service, it only needs to use /public/uploads for reading and writing uploads.