Updated knox and now the app hangs

/

I updated the version of knox in one of my Node.js projects. Had not done a library update in quite awhile, and since Node is getting closer to 1.0 release seemed like a good idea to update them all and keep moving towards 1.0 together. I did, and ran it, everything worked just as before except the program never terminated. I could tell by the expected actions all completing. Then it looked like the program just hung. No errors. Weird.

Being asynchronous my first thinking was that somewhere, something never called the callback, or returned where it was supposed to and was stuck hanging on something. I had some logging enabled so I put that on full so I could get some internal insight. Then I went with my favorite debugging tool: console. Nothing like a few console statements here and there to get a sense of what is happening.

After all this, everything looked just fine, just no termination. Next I started going into the callbacks, seeing what if anything was not being called back. I wrapped them up a bit so I would get a console notification as each executed. This was deeply nested into an async routine, itself inside another async routine. Everything still looked just fine, all my callbacks were executing.

Next step: commenting out areas I thought may be the problem. Sure enough, after commenting out a knox.putFile call everything terminated properly.

Old code

// client is the knox client, filpath is my local file, destination is the name in the s3 bucket
client.putFile(filepath, destination, callback);

Updated

client.putFile(filepath, destination, function(err, res){ res.resume(); callback(err); });

Before I was simply passing the callback through, all I cared about was the err, not the return value. Looks like now I need to call .resume() on the response. They say as much in their docs:

client.putFile('my.json', '/user.json', function(err, res){
  // Always either do something with `res` or at least call `res.resume()`.
});

Doesn't seem that this was the case <= 0.6.0. This is going to happen here and there, Node libraries are proceeding at a furious pace. Still glad I updated the library.