SupabaseS
Supabase4mo ago
lucksp

remove() doesn't seem to remove the file from a bucket

I am running a script to delete files:

await supabase.storage
  .from('myBucket')
  .remove([`myBucket/${duplicateFile.name}`]); // includes bucket in pathname

however, the file remains after. Things I have checked:

  • Policy: Only users who are authenticated & exist in a specific table of users is allowed:
Policies under storage.buckets
DELETE
Enable delete for ADMIN users

((auth.role() = 'authenticated'::text) AND (EXISTS ( SELECT 1
   FROM admin_users
  WHERE (admin_users."userId" = auth.uid()))))


  • Checked My bucket settings:
    [
    {
      "id": "myBucket",
      "name": "myBucket",
      "owner": null,
      "created_at": "2024-01-25 15:08:19.641355+00",
      "updated_at": "2024-01-25 15:08:19.641355+00",
      "public": false,
      "avif_autodetection": false,
      "file_size_limit": null,
      "allowed_mime_types": null,
      "owner_id": null
    }
    ]
  • Errors: none exist.
Any other ideas?
Was this page helpful?