Directus files
Tech support upgraded my Directus to using Docker and also migrated me to V2 and added a persistent volume for file storage earlier today. Now when I try and add an image I get "[SERVICE_UNAVAILABLE] Service "files" is unavailable. Couldn't save file.... " any ideas? Thanks.
Solution:Jump to solution
going to jump in here becuase ive seen this same thing when helping setup the Directus template, like attacler said the app is started as user
node
and the volume is mounted as root, set a RAILWAY_RUN_UID
service variable to 0
to run the app as root instead16 Replies
Project ID:
d911897c-20b8-46c5-8fa1-00af65bac5f5
d911897c-20b8-46c5-8fa1-00af65bac5f5
where was the volume mounted to on directus?
if you use Directus, you should mount the uploads folder at /directus/uploads
if it does not work after that, please share what the logs of your instance have
Mount path
The path where the volume will be mounted inside the container /directus/uploads
alright, do your logs say anything of the Directus instance?
Deploy logs?
Also, everything else is working fine
Well at least appears to be
yes, try to upload something and then see if anything usefull is logged there
[11:16:06.742] WARN: Couldn't save file 13dd53be-cf56-4c2f-93c9-0417b421b67d.png
[11:16:06.743] WARN: EACCES: permission denied, open '/directus/uploads/13dd53be-cf56-4c2f-93c9-0417b421b67d.png'
err: {
"type": "Error",
"message": "EACCES: permission denied, open '/directus/uploads/13dd53be-cf56-4c2f-93c9-0417b421b67d.png'",
"stack":
Error: EACCES: permission denied, open '/directus/uploads/13dd53be-cf56-4c2f-93c9-0417b421b67d.png'
"errno": -13,
"code": "EACCES",
"syscall": "open",
"path": "/directus/uploads/13dd53be-cf56-4c2f-93c9-0417b421b67d.png"
}
[11:16:07.418] WARN: Couldn't delete file 13dd53be-cf56-4c2f-93c9-0417b421b67d.png
[11:16:07.418] WARN: ENOENT: no such file or directory, unlink '/directus/uploads/13dd53be-cf56-4c2f-93c9-0417b421b67d.png'
err: {
"type": "Error",
"message": "ENOENT: no such file or directory, unlink '/directus/uploads/13dd53be-cf56-4c2f-93c9-0417b421b67d.png'",
"stack":
Error: ENOENT: no such file or directory, unlink '/directus/uploads/13dd53be-cf56-4c2f-93c9-0417b421b67d.png'
"errno": -2,
"code": "ENOENT",
"syscall": "unlink",
"path": "/directus/uploads/13dd53be-cf56-4c2f-93c9-0417b421b67d.png"
}
[11:16:07] POST /files 503 1.5s
[11:16:07] GET /files?aggregate[countDistinct]=id 304 121ms
[11:16:07] GET /files?filter[_and][0][type][_nnull]=true&filter[_and][1][folder][_null]=true&aggregate[countDistinct]=id 304 143ms
[11:16:07] GET /files?limit=25&fields[]=id&fields[]=modified_on&fields[]=type&fields[]=title&fields[]=type&fields[]=filesize&sort[]=-uploaded_on&page=1&filter[_and][0][type][_nnull]=true&filter[_and][1][folder][_null]=true 304 185ms
@Brody
Directus is running under a user called "node" (not root) might it be that the permissions are screwed in some way?
Solution
going to jump in here becuase ive seen this same thing when helping setup the Directus template, like attacler said the app is started as user
node
and the volume is mounted as root, set a RAILWAY_RUN_UID
service variable to 0
to run the app as root insteadI do that where? In the variables area?
Woohoo! That worked.....thank you so much!
no problem, do keep in mind that there are no backups for volumes right now
9/10 times i use some S3 storage so that i can reach the files anytime i need them
I think I'm going to go with Cloudinary for the images....once I read that chapter....lol