Handling DynamoDB BatchWrite Errors in Node.js

So, you’re building a Node.js app to do DynamoDB Batch Writes or better yet, you’re diving into AWS’ Lambda? You want to be a good programmer and handle errors gracefully, right? You came to the right place.

First, how do errors look? Notice how you just get an empty {} when all is good, well here is it how it looks if any items are unprocessed by DynamoDB:

Now, this is really cool because Amazon just perfectly returned all the code you need to do a new batch write.
All you need to do now is write a callback and ideally put in some exponential backoff logic, like so:

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on TumblrShare on RedditBuffer this pageDigg thisEmail this to someone
Tell Your Friends