storage update results in "The resource was not found"
Bug report
Describe the bug
When I try to update a file, basically replacing the content but keeping the same file name, I get an error "The resource was not found".
To Reproduce
- I get a file using a file input element.
- I assign a name to a name variable
- I upload the file to storage with:
await supabase.storage.from('bucketName').upload(fileName, files[0]) (no error, file is stored)
- I get another file with a file input element
- While using the same file name, I update the file with:
await supabase.storage.from('bucketName').update(fileName, files[0]) (errors with The resource was not found)
If I try to upload a different file with the same name, I do get an (expected) error "duplicate key value violates unique constraint "bucketid_objname""
Expected behavior
I expect the file in the bucket to be updated, different content with same file name.
System information
- OS: Ubuntu 22.04
- Browser chrome
- Version of supabase-js: 1.35.3
- Version of svelte-kit: 1.0.0-next.354
Hi @eric-naguras! Do you have any RLS policies added for storage objects? The "The resource was not found" message when performing the update of an existing object seems to indicate that you've added policies to permit INSERT of new objects, but not UPDATE of existing objects.
Closing for inactivity, feel free to reach out if needed further assistance
For anyone facing this issue despite having everything right in code, make sure you have the right RLS policies set and that all operations are allowed for such policy. Do that as you set the policy!