storage
storage copied to clipboard
Cannot Delete image from bucket
Hello dears, i have 2 days trying to delete an image from the bucket 1- the bucket is private 2- the bucket name is => images 3- i try multiple things and all fails
here is my code used to delete the image:
deleteImage(bucked: string, imageId: string) {
return this.supabaseConfig
.getSupabaseClient()
.storage.from(bucked)
.remove([${imageId}]);
}
Are you using the anon key or service key here @ahmedabdelhafez? if you are using the anon key, you may need to allow access by adding the right RLS policies in your dashboard
Are you using the anon key or service key here @ahmedabdelhafez? if you are using the anon key, you may need to allow access by adding the right RLS policies in your dashboard
Hello @inian I am using the example in the docs, the problem also it give me ok that the item is deleted but when move to the supabase storage I found that the image is not deleted
Can you share a reproducible example? If you don't want to share the exact code here, feel free to send us a support ticket with the project ref, key and the code you are using at https://app.supabase.io/support/new
Thanks!
Can you share a reproducible example? If you don't want to share the exact code here, feel free to send us a support ticket with the project ref, key and the code you are using at https://app.supabase.io/support/new
Thanks!
hello @inian here is the code example i put the code in the service and pass parameters to the function
deleteImage(bucket: string, imageId: string) { return this.supabaseConfig .getSupabaseClient() .storage.from(bucket) .remove([${imageId}]); }
and also i want to say that the bucket is private and i can upload image to it but the download and delete i cannot do this step why i don't know
Are you using the anon key or service key here? if you are using the anon key, can you share the current RLS policies you have on the storage schema?
Might be easier to debug if you share the url you are trying to access / delete
Are you using the anon key or service key here? if you are using the anon key, can you share the current RLS policies you have on the storage schema?
Might be easier to debug if you share the url you are trying to access / delete
here is all policies granted to the bucket

I have the same problem, is there any solution for this problem?
Hello @ahmedabdelhafez and @vab1997 we would need to see the RLS you created for the DELETE operation. Feel free to paste it here, we can help you to debug further
Feel free to re-open when providing more details