Unable to upload objects to R2 bucket using aws-sdk-php

Hi there.

Using the aws-sdk-php interface to R2.

Receiving the following error when attempting to insert any objects into the bucket.

Does anyone have any ideas?

Next Aws\S3\Exception\S3Exception: Error executing "PutObject" on "https://3dart-social.951fb64f9ea769c08299bfd0514a3bbe.r2.cloudflarestorage.com/public/m/_v2/498180705927720961/a48ad3dc0-89cf68/Qs6qQse3x0XZ/Kgos2RaixGcowZMKScWI7pxpSeO3s2HINR4jL0Je.jpg"; AWS HTTP error: Server error: `PUT https://3dart-social.951fb64f9ea769c08299bfd0514a3bbe.r2.cloudflarestorage.com/public/m/_v2/498180705927720961/a48ad3dc0-89cf68/Qs6qQse3x0XZ/Kgos2RaixGcowZMKScWI7pxpSeO3s2HINR4jL0Je.jpg` resulted in a `501 Not Implemented` response:
<?xml version="1.0" encoding="UTF-8"?><Error><Code>NotImplemented</Code><Message>Header &apos;x-amz-acl&apos; with value (truncated...)
NotImplemented (server): Header 'x-amz-acl' with value 'public-read' not implemented - <?xml version="1.0" encoding="UTF-8"?><Error><Code>NotImplemented</Code><Message>Header &apos;x-amz-acl&apos; with value &apos;public-read&apos; not implemented</Message></Error> in /var/www/pixelfed/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php:195

Here is the relevant configuration:


## S3 Configuration (Post-Installer)
PF_ENABLE_CLOUD=true
FILESYSTEM_DRIVER=local
FILESYSTEM_CLOUD=s3
AWS_ACCESS_KEY_ID=REDACTED
AWS_SECRET_ACCESS_KEY=REDACTED
AWS_DEFAULT_REGION=auto
AWS_BUCKET=3dart-social
AWS_URL=https://cdn.3dart.social
AWS_ENDPOINT=https://951fb64f9ea769c08299bfd0514a3bbe.r2.cloudflarestorage.com/3dart-social
#AWS_USE_PATH_STYLE_ENDPOINT=false

Appreciate any thoughts and insights.

Thanks.

R2 not support x-amz-acl now, so you need to set the ACL to private.

https://developers.cloudflare.com/r2/data-access/s3-api/api/#implemented-object-level-operations

$s3Client->upload($this->bucket, $key, $body, $acl = 'private');