Skip to content
This repository has been archived by the owner on Jun 5, 2018. It is now read-only.

Errors when adding documents #2

Closed
Jonovono opened this issue May 8, 2013 · 5 comments · Fixed by #5
Closed

Errors when adding documents #2

Jonovono opened this issue May 8, 2013 · 5 comments · Fixed by #5

Comments

@Jonovono
Copy link

Jonovono commented May 8, 2013

I have been using the awssum amazon cloudsearch api for awhile. Just recently I started getting a 411 error when adding a document.

Here is a pastebin: http://pastebin.com/tBrvMWU2

Sometimes I get 411 or 400. It used to work but for some reason just recently stopped and I can't figure out why.

This was the original code I used: https://github.com/Jonovono/node-awssum/blob/master/lib/amazon/cloudsearch.js

@Jonovono
Copy link
Author

Jonovono commented May 9, 2013

To fix I had to add: setHeader(options.headers, 'Content-Length', Buffer.byteLength(options.body));

in awssum.js

@pboyer
Copy link

pboyer commented Jun 24, 2013

RIght, I dropped the following into line 956 of awssum.js. Not sure if this will break other things, though...

    if (options.body){
        options.headers['content-length'] = options.body.length;
    }

@chilts
Copy link
Owner

chilts commented Jun 24, 2013

Ok cool, thanks. I'll make sure that that gets set in the config.js related to that operation so that it's not in awssum.js (ie. you're right, not everything needs that, but easy enough for me to add to the config).

:)

Cheers,
Andy

@pboyer
Copy link

pboyer commented Jun 25, 2013

Yeah, if it wasn't obvious, it definitely is not safe to put that line in awssum.js. It breaks S3 uploads, for example, that have precomputed Content-Length headers. It also disables chunked encoding.

@jhnlsn
Copy link
Contributor

jhnlsn commented Jul 16, 2013

So what is the fix for this? Are you going to put this into config.js or shoudl I just continue with the hack in awssum.js

@jhnlsn jhnlsn mentioned this issue Jul 16, 2013
@chilts chilts closed this as completed in #5 Nov 20, 2013
chilts added a commit that referenced this issue Nov 20, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants