You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So I have a public bucket which can directly be access by a link (can see the data if I copy paste that link on the browser).
However, when I try access the bucket via aws-sdk-php (v3.305.1) library it gives me the error:
"The authorization header is malformed; a non-empty Access Key (AKID) must be provided in the credential."
This is the code I have written to access the objects of my public bucket:
$s3Client = newS3Client([
"version" => "latest"
"region" => "us-east-1"
"credentials" => false // since its a public bucket
]);
$data = $s3Client->listObjectsV2([
"bucket" => "my bucket name"
]);
As per the AWS Documentation it says this is how to access via anonymous clients using the code above.
As a matter of fact this happens with any of the S3 functions (getObject, putObject, deleteObject, etc) that I use when I put [credentials => false]
Expected Behavior
Expected behavior is to list the objects of the S3 bucket.
Current Behavior
The following exception is thrown:
Aws\S3\Exception\S3Exception: Error executing "ListObjectsV2" on "public_bucket_url"; AWS HTTP error: Client error: GET public_bucket_url resulted in a 400 Bad Request response:
AuthorizationHeaderMalformedThe authorization header (truncated...)
AuthorizationHeaderMalformed (client): The authorization header is malformed; a non-empty Access Key (AKID) must be provided in the credential. - AuthorizationHeaderMalformedThe authorization header is malformed; a non-empty Access Key (AKID) must be provided in the credential.F3MPEAGWS7NYARRD3J5SLAxac8koK4F5lhwBV9aj/aBLBGtDcH2wWfOfYyRoqG3EWFhfne9I0Spk2OBz2ruYqY/YzMU=
Caused by
GuzzleHttp\Exception\ClientException: Client error: GET public_bucket_url resulted in a 400 Bad Request response:
This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
Sorry to hear about the issues. It turns out our endpoint resolution was overriding these requests and forcing them to use SIgV4. The fix will be available in today's release.
Describe the bug
So I have a public bucket which can directly be access by a link (can see the data if I copy paste that link on the browser).
However, when I try access the bucket via aws-sdk-php (v3.305.1) library it gives me the error:
"The authorization header is malformed; a non-empty Access Key (AKID) must be provided in the credential."
This is the code I have written to access the objects of my public bucket:
As per the AWS Documentation it says this is how to access via anonymous clients using the code above.
As a matter of fact this happens with any of the S3 functions (getObject, putObject, deleteObject, etc) that I use when I put
[credentials => false]
Expected Behavior
Expected behavior is to list the objects of the S3 bucket.
Current Behavior
The following exception is thrown:
Aws\S3\Exception\S3Exception: Error executing "ListObjectsV2" on "public_bucket_url"; AWS HTTP error: Client error:
GET public_bucket_url
resulted in a400 Bad Request
response:AuthorizationHeaderMalformed
The authorization header (truncated...)AuthorizationHeaderMalformed (client): The authorization header is malformed; a non-empty Access Key (AKID) must be provided in the credential. -
AuthorizationHeaderMalformed
The authorization header is malformed; a non-empty Access Key (AKID) must be provided in the credential.F3MPEAGWS7NYARRD3J5SLAxac8koK4F5lhwBV9aj/aBLBGtDcH2wWfOfYyRoqG3EWFhfne9I0Spk2OBz2ruYqY/YzMU=Caused by
GuzzleHttp\Exception\ClientException: Client error:
GET public_bucket_url
resulted in a400 Bad Request
response:AuthorizationHeaderMalformed
The authorization header (truncated...)/var/www/html/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
/var/www/html/vendor/guzzlehttp/guzzle/src/Middleware.php:69
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:204
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:153
/var/www/html/vendor/guzzlehttp/promises/src/TaskQueue.php:48
/var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php:159
/var/www/html/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php:184
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:248
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:224
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:269
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:226
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:269
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:226
/var/www/html/vendor/guzzlehttp/promises/src/Promise.php:62
/var/www/html/vendor/aws/aws-sdk-php/src/AwsClientTrait.php:58
/var/www/html/vendor/aws/aws-sdk-php/src/AwsClientTrait.php:86
Reproduction Steps
listObjectV2
function.Possible Solution
No response
Additional Information/Context
No response
SDK version used
v3.305.1
Environment details (Version of PHP (
php -v
)? OS name and version, etc.)PHP 8.1, Windows 10, Docker
The text was updated successfully, but these errors were encountered: