#1759·flysystem

$config in AwsS3V3Adapter copy function is null/empty

Author: srabouinCreated Feb 29, 2024Updated Jul 15, 2026

Bug Report

Q A
Flysystem Version 3.24.0
Adapter Name AwsS3V3Adapter
Adapter version 3.24.0

Summary

I am using Laravel 9.52.16 and the S3 driver to upload/move files to Cloudflare R2. The upload is in a temporary folder, and then I move it to the final folder. The move function is the issue.

In the config, I have set visibility to 'private' to prevent calling GetObjectAcl that is not supported by R2, but after upgrading to 3.24.0 it gave the error that GetObjectAcl is not supported.

During troubleshooting I just dumped the $config variable when the copy function is called here https://github.com/thephpleague/flysystem/blob/b25a361508c407563b34fac6f64a8a17a8819675/src/AwsS3V3/AwsS3V3Adapter.php#L418 and found it was null/empty. Reverting to 3.15.0 and everything is working fine again.

It's possible I missed something?

How to reproduce

R2 config:

'disks' => [
        'r2' => [
            'driver' => 's3',
            'key' => env('CLOUDFLARE_R2_ACCESS_KEY_ID'),
            'secret' => env('CLOUDFLARE_R2_SECRET_ACCESS_KEY'),
            'region' => env('CLOUDFLARE_R2_REGION'),
            'bucket' => env('CLOUDFLARE_R2_BUCKET'),
            'disable_asserts' => true,
            'visibility' => 'private',
            'endpoint' => env('CLOUDFLARE_R2_ENDPOINT'),
            'url' => env('CLOUDFLARE_R2_URL'),
            'domain' => env('CLOUDFLARE_R2_FILE_DOMAIN', ''),
            'domain_original' => env('CLOUDFLARE_R2_ORIGINAL_DOMAIN', ''),
            'throw' => true,
        ],
]

Single line of code:

Storage::disk('r2')->move($from, $to);

Actual error, removed irrelevant lines:

[previous exception] [object] (GuzzleHttp\\Exception\\ServerException(code: 501): Server error: `GET https://bucket.x.r2.cloudflarestorage.com/submissions/tmp/file.zip?acl` resulted in a `501 Not Implemented` response:
<?xml version=\"1.0\" encoding=\"UTF-8\"?><Error><Code>NotImplemented</Code><Message>GetObjectAcl not implemented</Message>< (truncated...)
 at /var/www/html/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113)
[...]
#14 /var/www/html/vendor/league/flysystem-aws-s3-v3/AwsS3V3Adapter.php(440): Aws\\AwsClient->execute(Object(Aws\\Command))
#15 /var/www/html/vendor/league/flysystem-aws-s3-v3/AwsS3V3Adapter.php(410): League\\Flysystem\\AwsS3V3\\AwsS3V3Adapter->visibility('submissions/tmp...')
#16 /var/www/html/vendor/league/flysystem-aws-s3-v3/AwsS3V3Adapter.php(399): League\\Flysystem\\AwsS3V3\\AwsS3V3Adapter->copy('submissions/tmp...', 'submissions/102...', Object(League\\Flysystem\\Config))
#17 /var/www/html/vendor/league/flysystem/src/Filesystem.php(137): League\\Flysystem\\AwsS3V3\\AwsS3V3Adapter->move('submissions/tmp...', 'submissions/102...', Object(League\\Flysystem\\Config))
#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php(537): League\\Flysystem\\Filesystem->move('submissions/tmp...', 'submissions/102...')
#19 /var/www/html/app/Services/Legacy/SubmissionService.php(710): Illuminate\\Filesystem\\FilesystemAdapter->move('submissions/tmp...', 'submissions/102...')
[...]