Repository navigation
Description
👟 Reproduction steps
-
Run a self-hosted Appwrite 2.2.0 with S3-compatible storage:
_APP_STORAGE_DEVICE=s3 _APP_STORAGE_S3_ENDPOINT=nbg1.your-objectstorage.com _APP_STORAGE_S3_REGION=nbg1 _APP_STORAGE_S3_BUCKET=my-bucket _APP_STORAGE_S3_ACCESS_KEY=... _APP_STORAGE_S3_SECRET=... -
Create a storage bucket and upload a file. The object shows up in
my-bucketasstorage/uploads/app-<projectId>/<bucketId>/<fileId>.<ext>. -
Delete the storage bucket, from the Console or with
DELETE /v1/storage/buckets/{bucketId}(returns 204). -
The deletes worker finishes without any error, but every object under
storage/uploads/app-<projectId>/<bucketId>/is still inmy-bucket.
👍 Expected behavior
Deleting a storage bucket should delete its files from the S3 bucket.
👎 Actual Behavior
Nothing is deleted on the S3 side, and nothing is logged.
When _APP_STORAGE_S3_ENDPOINT is set, getDevice() puts the bucket name at the start of the root path and gives the bare endpoint as host (app/init/resources.php#L367-L369):
$bucketRoot = (! empty($bucket) ? "{$bucket}/" : '') . \ltrim($root, '/');
return new S3($bucketRoot, $accessKey, $accessSecret, $endpoint, $region);Single-object requests work because the key starts with the bucket (/my-bucket/storage/..., path-style). Uploads, chunked uploads, downloads, previews and single file deletions are all fine.
Bucket deletion calls $deviceForFiles->deletePath($bucketId) (Deletes.php#L1770-L1777). In utopia-php/storage, listObjects() always sends GET / with the whole root as prefix (S3.php#L374-L399):
GET https://nbg1.your-objectstorage.com/?list-type=2&prefix=my-bucket/storage/uploads/app-<projectId>/<bucketId>
With no bucket in the path, this is a ListBuckets request. The provider answers with ListAllMyBucketsResult, which has no Contents, so deletePath() leaves its loop and returns true (S3.php#L490-L527). The batch POST /?delete it would send next has the same problem.
I reproduced it on Hetzner Object Storage: the request above returns the bucket list, and the same query sent to /my-bucket with prefix=storage/uploads/... returns the files. It should be the same with any provider used through _APP_STORAGE_S3_ENDPOINT, since GET / on the service endpoint means ListBuckets in the S3 API. The code is unchanged in utopia-php/storage 4.2.0.
Related, from reading the code (not reproduced): project deletion calls delete($device->getRoot(), true) on the files, sites, functions, builds and cache devices (Deletes.php#L995-L1019), but S3::delete() ignores $recursive and sends a single DELETE on the directory key (S3.php#L358-L365). AWS extends S3 without overriding it, so a deleted project's files would stay on any S3 device, AWS included.
A possible fix: give the bucket to the S3 device (the constructor already has a bucket argument) and send listObjects() and the batch delete to /{bucket} with a prefix relative to it. And make delete($path, true) go through deletePath().
🎲 Appwrite version
2.2.0 (self-hosted)
💻 Operating system
Linux
🧱 Your Environment
Appwrite 2.2.0 self-hosted, installed with the official installer (default Docker Compose layout, PostgreSQL). utopia-php/storage 4.1.0 as bundled. Ubuntu 26.04. Storage on Hetzner Object Storage (nbg1), configured as shown in the reproduction steps. Nothing else customized.
Activity
HarshMN2345 commentedon Oct 29, 2026
Fixed in #14626: deleting a bucket on S3-compatible storage now removes all of its objects. Thanks for reporting it!