Last active
March 25, 2019 08:47
-
-
Save thomasmichaelwallace/a59601b2f387baacd40fe303411b7a62 to your computer and use it in GitHub Desktop.
Http options timeouts for lambda function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AWS from 'aws-sdk'; | |
const s3 = new AWS.S3({ | |
httpOptions: { | |
connectTimeout: 2 * 1000, // time succeed in starting the call | |
timeout: 5 * 1000, // time to wait for a response | |
// the aws-sdk defaults to automatically retrying if either of these limits are met. | |
}, | |
}); | |
// use S3 happily! | |
const ddb = new AWS.DynamoDB.DocumentClient({ | |
// DocumentClient needs a nested service configuration: | |
service: new aws.DynamoDB({ | |
httpOptions: { connectTimeout: 2000, timeout: 5000 }, | |
}), | |
}); | |
// use DynamoDB through the DocumentClient interface happily! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment