Storage driver seems to be configured properly as files upload and viewing is fine.
By the error message it’s evident that Directus tries to access file in storage by malformed uuid with missing first symbol. For example “19fb1fa-6c68-411e-82b1-ef43cedc326d” instead of “019fb1fa-6c68-411e-82b1-ef43cedc326d”.
Both REST API and GQL requests for file or files delete return error, examples (notice first symbol of uuid in error):
# REST API file delete request
curl -X DELETE -H "Authorization: Bearer TOKEN" https://gcs-directus.domain/files/019fb1fa-6c68-411e-82b1-ef43cedc326d
{"errors":[{"message":"No such object: gcs-bucket/uploads/19fb1fa-6c68-411e-82b1-ef43cedc326d.jpeg","extensions":{"code":"INTERNAL_SERVER_ERROR"}}]}
# GQL files delete mutation
mutation {
delete_files_items(ids: [“751d3922-7806-4eec-bceb-5f15fc24c802”]) {
ids
}
}
{
“data”: {
“delete_files_items”: null
},
“errors”: [
{
“message”: “No such object: gcs-bucket/uploads/51d3922-7806-4eec-bceb-5f15fc24c802.png”,
“extensions”: {
“code”: “INTERNAL_SERVER_ERROR”
},
“locations”: [
{
“line”: 2,
“column”: 2
}
],
“path”: [
“delete_files_items”
]
}
]
}
The same error is seen in Directus UI on file update or deletion. Directus configured with Terraform as follows:
env {
name = "STORAGE_LOCATIONS"
value = "local"
}
env {
name = "STORAGE_LOCAL_DRIVER"
value = "gcs"
}
env {
name = "STORAGE_LOCAL_BUCKET"
value = var.storage_bucket
}
I wonder what is wrong with my configuration as it seems that no other people faced it as I didn’t find simislar issues. I’m using Directus from directus/directus:11.7.2 Docker image.
Hello, Nikita check if the service account that you are using for the GCP bucket has the delete and update access.
– ahmad_quvorHello, Ahmad. Thanks for quick response. Service account for storage access is set to broad role
– nikitaroles/storage.objectAdminfor now. Permissions shouldn't be the issue. I suspectuuidmismatch from error message to be related to the core problem.Found the issue — should've set
– nikitaSTORAGE_LOCAL_ROOTtouploadsvalue. Leaving it not defined or using./uploadswill result it behaviour I've seen when creation and reading are done correctly but deletion results in malformed UUID.