Lepozepo/S3

Library reports success even when the upload fails

Closed this issue · 2 comments

I have noticed that the S3.upload() method returns success (percent_uploaded = 100, url, etc.) even when the Amazon S3 does not return HTTP 200 (OK) - for example due to misconfiguration (missing S3.config.region, in my case).

In addition to this, I believe the error-handling logic in Meteor.methods._S3upload is faulty, mainly to the fact, that if you throw new Meteor.Error inside the S3.knox.putStream (ClientRequest) context, it brings down the whole application (unhandled exception). Throwing error from _S3upload context is fine and results in err being propagated back to the client via callback.

I have created a pull request fixing this: #50

Please note that I only fixed S3.upload(), not the multi-part methods, as I am not using them at the moment

I've upgraded the development branch to follow this method off error handling for both mpu and non-mpu. Thanks for the help!