I can't remove file from supabase storage ... ```c...
# off-topic
m
I can't remove file from supabase storage ...
Copy code
const deleteFromStorage = await supabase.storage.from('slider').remove([`/public/${fileName!}`]).then();
the request return status 200 OK with an empty array in response but the file has not been deleted what can I do to solve this ?!
@User
@User
b
looking into this
m
thx ❤️
b
you don't need the slash at the beginning,
public/${fileName!}
should work
m
I'll try it
same
@User
b
oh, you're using the public key, not the service_role key. you'll need to add a security rule to allow delete: https://supabase.io/docs/guides/storage#add-security-rules
it isn't helpful that there isn't an appropriate error message, I'll look into that
m
thx bro I'll check it
@User I used the Service Role Key
then I add security rule to allow delete
but still have the same issue
did I miss any step ?!
@User
b
So you can’t delete the file even if using the service role key?
m
yes I can't
b
I was able to create a file using:
await client.storage.from('slider').upload('public/abc.jpg', 'abc')
and subsequently delete it using:
await client.storage.from('slider').remove(['public/abc.jpg'])
m
I can upload file smoothly but can't remove it 😅
b
that's really strange, could you email the exact code you're using to support@supabase.io please?