After making some changes and redeploying payload, why can't I access media files?
If you right click on an image and grab the URL
Is it the path you're expecting?
Did you change any URL configurations?
Permissions, etc
The image path is correct. I also didn't change any url configurations. I added uploads to my user collection and redeployed to railway.
But the image path returns a 404?
I would check permissions on the upload collection
Permissions on the folder
as well
Correct, it returns 404. The permissons haven't changed. This happens every time I do a redeploy
What are the folder permissions
wondering if they are somehow altered on deploy
read
hmm
Wondering if it is a static dir issue
I've had issues where I've had to add an nginx block for uploads
But you're saying it works sometimes, or hasnt yet?
It has never worked on a redeploy. Even when I first set things up locally it didn't work on the first deploy
Can you adjust your nginx settings on railway
out of curiosity
or was that configured automatically
There's no mention of nginx in the railway docs
I'm assuming it's configured automatically
I am seeing some previous posts here about Railway and inconsistent file storage
This may not still be the case
But it may be useful to search this discord channel for Railway
And see if anyone has resolved issues pertaining to media / uploads
There's no mention of this issue on this doscord channel
I've been in touch with railway and bizarrely they don't offer persistent storage yet. However, they've released persistent storage as a feature for users on their beta testing program.
Your payload instance is likely writing to Railway's ephemeral disk, then on redeploy it gets completely blown away
Might have to hook up some cloud storage via
https://github.com/payloadcms/plugin-cloud-storageThe media is in MongoDB Atlas along with my posts which display fine after a redeploy. So why would my media not show but my posts do when both are in a database on a separate cloud service?
When you redeploy Payload on Railway, the images are disappearing because the actual binary data of the images is stored in the file system, not in MongoDB.
During the redeployment process, the file system may get reset or modified, resulting in the loss of the image files. To avoid this issue, there are a couple of options you can consider:
1. Create a persistent mount on Railway: If possible, you can configure Railway to use a persistent storage solution where the image files are stored. This way, even after redeployments, the image files will remain intact.
2. Use the Payload storage plugin as Elliot suggested.
I've used the payload cloud plugin with an S3 bucket as suggested and this has solved the issue. However, the issue now is the slow loading times of the images. I've setup a CloudFront CDN for the S3 bucket but I can't find any information on how to use my S3 bucket with payload via the CDN
Just to clarify, you've configured the cloud-storage-plugin for your own S3 bucket, but the loading times are slow, and you'd like to configure a CDN somehow?
correct
This seems like a duplicate of your thread over here. We'll continue there.
https://discord.com/channels/967097582721572934/1125374059690078278Star
Discord
online
Get dedicated engineering support directly from the Payload team.