Aws-sdk-php: s3->putBucketAcl() => This request does not support content

Created on 29 Dec 2014  Â·  8Comments  Â·  Source: aws/aws-sdk-php

Hi there,

I'm trying for HOURS to make s3->putBucketAcl() works, without any success.

I'm having various exception errors, and I'm currently stuck on this one:

400 - Bad Request - This request does not support content

By the way, what is the difference between 'ACL' => 'string' asked and grantees permissions?
What I want is just to update my buckect ACLs (add new ACL access).

Most helpful comment

Basically, you should be using the 'ACL' param –OR– the 'Grants' and 'Owner' params, not both. The error message you received does not make that very obvious, but that message comes directly from the service, and the SDK just passes it along. The Access Control List Overview page in the S3 developer guide will help explain the difference between the simpler Canned ACL ('ACL' param) and the finer-grained Access Control Policies ('Grants' and 'Owner' params).

All 8 comments

Basically, you should be using the 'ACL' param –OR– the 'Grants' and 'Owner' params, not both. The error message you received does not make that very obvious, but that message comes directly from the service, and the SDK just passes it along. The Access Control List Overview page in the S3 developer guide will help explain the difference between the simpler Canned ACL ('ACL' param) and the finer-grained Access Control Policies ('Grants' and 'Owner' params).

Hey jeremeamia,

And thanks for your reply.

But if I remove param 'ACL' and only use 'Grants' and 'Owner' params (like in the screenshot I provided in my first post), then I get the following error:

The XML you provided was not well-formed or did not validate against our published schema

Is there any way in PHP SDK to get the XML sent to Amazon, this way I'll be able to understand where the XML is not well-formed?

The params I used with s3->putBucketAcl() are the same in previous screenshot, without 'ACL' you told me to remove (because I want to use Access Control Policies).

Thanks for your help

Is there any way in PHP SDK to get the XML sent to Amazon, this way I'll be able to understand where the XML is not well-formed?

Definitely! You can attach a wire logger to see the raw request and response. Doing that will definitely help us debug.

Hmm tryed to use LogPlugin, but not sure this is the best way to understand why AWS reply a bad request, because I cannot get XML details:

Can you show us the code you used to attach the logger? We need to see the XML body of the request in order to see why/if it was malformed.

I just noticed that a potential problem could be that "Id" under "Owner" should be uppercase: "ID".

I just wrote some test code to check my "Id" vs. "ID" theory, and I'm almost positive that is your problem. "ID" should be uppercase.

@jeremeamia: WON-DER-FULL !!!
You're amazing, you found my bug :-)
Many many many thanks for your help.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

muratsplat picture muratsplat  Â·  4Comments

pihish picture pihish  Â·  3Comments

sm2017 picture sm2017  Â·  4Comments

sh-ogawa picture sh-ogawa  Â·  4Comments

aanton picture aanton  Â·  4Comments