deleteBucket()

Deletes an existing bucket. A bucket can't be deleted with existing objects inside it. You must first empty() the bucket.

1const { data, error } = await supabase
2  .storage
3  .deleteBucket('avatars')

Parameters#

  • idrequired
    string

    The unique identifier of the bucket you would like to delete.

Notes#

  • RLS policy permissions required:
    • buckets table permissions: select and delete
    • objects table permissions: none
  • Refer to the Storage guide on how access control works

Examples#

Delete bucket#

1const { data, error } = await supabase
2  .storage
3  .deleteBucket('avatars')