Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3.getBucketPolicy() returns error for valid policy #49

Closed
BewhiskeredBard opened this issue Jan 30, 2013 · 5 comments
Closed

S3.getBucketPolicy() returns error for valid policy #49

BewhiskeredBard opened this issue Jan 30, 2013 · 5 comments
Assignees
Milestone

Comments

@BewhiskeredBard
Copy link

When calling S3.getBucketPolicy(), I'm getting the following error passed to the callback:

{ code: 'AWS.XML.Parser.Error',
  message: 'Non-whitespace before first tag.\nLine: 0\nColumn: 1\nChar: {' } 
@BewhiskeredBard
Copy link
Author

The issue here is that the HTTP response body is pure JSON, but it's being parsed as XML instead.

@trevorrowe
Copy link
Member

The API configuration for the S3 client correctly indicates the response data should have a Policy property that should be sourced from the HTTP response body. It appears the RestXml service interface is not looking at this portion of the API configuration and therefore falls back onto the default XML parsing.

This should not be a difficult fix.

@ghost ghost assigned trevorrowe and lsegal Jan 30, 2013
@lsegal lsegal closed this as completed in f9992bc Jan 30, 2013
@BewhiskeredBard
Copy link
Author

Awesome. I'm assuming a new version will be published to npm shortly?

@lsegal
Copy link
Contributor

lsegal commented Jan 30, 2013

There will be another release including this fix. Until then, you can ignore this parser error and use the following workaround:

s3.client.getBucketPolicy(params, function() {
  console.log(this.httpResponse.body.toString());
});

lsegal added a commit that referenced this issue Jan 30, 2013
Non-binary payloads will now be returned as strings, not Buffers

References #49
@lock
Copy link

lock bot commented Sep 30, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants