S3 via Fastly Object storage - deleteDirectory fails unless the folder is empty (Recursive delete is broken?)
Hello,
I'm working on github.com/pixelfed/pixelfed and recently moved my instance from wasabi to fastly object storage....
and then I noticed my avatar update process was broken...
the code $disk->deleteDirectory($testPrefix); fails on Fastly, but works on AWS and Wasabi if the folder contains any sub. folders/files.
I've contacted Fastly to confirm their side, but this might be a compatibility issue on your side?
It also works on other S3 compatible storage systems, so I would be very surprised if this was a Flysystem issue. If anything, I don't have enough information to investigate, so not much I can do.
notes: I believe this is fastly.
> POST https://us-west.object.fastlystorage.app/xxxxxxxxxxxxxxxxxxxxx?delete
> Status Code: 400 Bad Request
> Method: POST (with XML body listing files to delete)
> Body: <Delete><Object><Key>test-fastly-delete-1763805349/test.txt</Key></Object></Delete>
> =================================
> exception_class: League\Flysystem\UnableToDeleteDirectory
> message: Unable to delete directory located at: test-fastly-delete-1763804550.
> code: 0
> file: /home/kiro1/Documents/pixelfed/vendor/league/flysystem/src/UnableToDeleteDirectory.php
> line: 27
> location: test-fastly-delete-1763804550
> reason:
> previous_exception: Aws\S3\Exception\S3Exception
> previous_message: Error executing "DeleteObjects" on "https://us-west.object.fastlystorage.app/xxxxxxxxxxxxxxxxxxxxx?delete"; AWS HTTP error: Client error: `POST https://us-west.object.fastlystorage.app/xxxxxxxxxxxxxxxxxxxxx?delete` resulted in a `400 Bad Request` response:
> <Error><Code>InvalidRequest</Code><Message>Invalid request.</Message><Resource>/xxxxxxxxxxxxxxxxxxxxx</Resource> (truncated...)
> InvalidRequest (client): Invalid request. - <Error><Code>InvalidRequest</Code><Message>Invalid request.</Message><Resource>/fedistoragepixelfedaustaging1</Resource><RequestId>xxxxxxxxxxxxxxxxxxxxx</RequestId></Error>
> previous_code: 0
> aws_error_code: InvalidRequest
> aws_error_type: client
> aws_request_id: xxxxxxxxxxxxxxxxxxxxx
> status_code: 400
> response_status: 400
> response_reason: Bad Request
> response_headers:
> Connection: ["keep-alive"]
> Content-Length: ["183"]
> access-control-allow-origin: ["*"]
> x-served-by: ["cache-mel11239-MEL"]
> date: ["Sat, 22 Nov 2025 09:42:33 GMT"]
> response_body: <Error><Code>InvalidRequest</Code><Message>Invalid request.</Message><Resource>/xxxxxxxxxxxxxxxxxxxxx</Resource><RequestId>xxxxxxxxxxxxxxxxxxxxx</RequestId></Error>
> transfer_info:
> http: [[]]
> request_method: POST
> request_uri: https://us-west.object.fastlystorage.app/xxxxxxxxxxxxxxxxxxxxx?delete
> request_headers:
> Host: ["us-west.object.fastlystorage.app"]
> Content-Type: ["application\/xml"]
> Content-Length: ["171"]
> X-Amz-User-Agent: [""]
> x-amz-checksum-crc32: ["xxxxxxxxxxxxxxxxxxxxx=="]
> aws-sdk-invocation-id: ["xxxxxxxxxxxxxxxxxxxxx"]
> aws-sdk-retry: ["0\/0"]
> x-amz-content-sha256: ["xxxxxxxxxxxxxxxxxxxxx"]
> X-Amz-Date: ["xxxxxxxxxxxxxxxxxxxxx"]
> Authorization: ["AWS4-HMAC-SHA256 Credential=xxxxxxxxxxxxxxxxxxxxx\/20251122\/us-west\/s3\/aws4_request, SignedHeaders=host;x-amz-checksum-crc32;x-amz-content-sha256;x-amz-date;x-amz-user-agent, Signature=xxxxxxxxxxxxxxxxxxxxx"]
> User-Agent: ["aws-sdk-php\/3.359.12 ua\/2.1 OS\/Linux#6.14.0-35-generic lang\/php#8.4.14 m\/P,Z,U,C,e,N,b"]
> request_body: <?xml version="1.0" encoding="UTF-8"?>
> <Delete xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><Object><Key>test-fastly-delete-1763804550/test.txt</Key></Object></Delete>
>
> command_name: DeleteObjects
> command_params:
> Bucket: xxxxxxxxxxxxxxxxxxxxx
> Delete: {"Objects":[{"Key":"test-fastly-delete-1763804550\/test.txt"}]}
> @http: []
> @context: {"signature_version":"s3v4","signing_service":"s3","signing_region":"us-west"}
This issue is resolved. Fastly have fixed it on their side.