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

copyObject not working when replacing metadata #30

Closed
NeoPhi opened this issue Jan 10, 2013 · 5 comments
Closed

copyObject not working when replacing metadata #30

NeoPhi opened this issue Jan 10, 2013 · 5 comments
Milestone

Comments

@NeoPhi
Copy link

NeoPhi commented Jan 10, 2013

When trying to use s3.client.copyObject with MetadataDirective: 'REPLACE' I don't see standard metadata headers such as CacheControl or ContentType being included in the request. Additionally the request fails with:

<Error><Code>NotImplemented</Code><Message>A header you provided implies functionality that is not implemented</Message><Header>Transfer-Encoding</Header><RequestId>E45E0F55BA68E46D</RequestId><HostId>...</HostId></Error>

Indicating that the PUT request is including a header I didn't specify causing it to be rejected with a status code of 501. Seems like a variation of: https://forums.aws.amazon.com/message.jspa?messageID=191792

@NeoPhi
Copy link
Author

NeoPhi commented Jan 10, 2013

In looking around a little more it looks like in s3.api.js the copyObject definition doesn't specify including all of the headers that a standard putObject request does which should address the first problem I was seeing of metadata not being included.

@NeoPhi
Copy link
Author

NeoPhi commented Jan 10, 2013

I was able to work around the Transfer-Encoding issue with this little hack in http.js handleRequest right after the options object is created:

    if ((options.method === 'PUT') && (!request.body)) {
      if (!options.headers) {
        options.headers = {};
      }
      if (!options.headers['Content-Length']) {
        options.headers['Content-Length'] = 0;
      }
    }

This would need to be cleaned up to be a general solution to the problem.

lsegal added a commit that referenced this issue Jan 10, 2013
Adds a new 'afterBuild' hook event and listener named
AWS.EventListeners.Core.SET_CONTENT_LENGTH to build Content-Length
on headers after services build the request object. This ensures
that content length is set consistently for all input types regardless
of the service interface.

Note: afterBuild is a private event and is reserved for internal use only.

Related to (but does not completely fix) #30
@lsegal
Copy link
Contributor

lsegal commented Jan 10, 2013

The above commit should fix the copyObject method failing outright; it does not address the other part of your issue, though (still working on that one).

@trevorrowe
Copy link
Member

The missing headers should have been addressed in commit 362ed44. I was able to use the latest (unreleased) code to perform a copy object. This should go out with our next release.

@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