-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lambda Timeout when using DynamoDB #1086
Comments
Thanks @chrisradek I've the lambda locally with this three simple lignes var aws = require('aws-sdk');
var dynamo = new aws.DynamoDB({
region: 'eu-west-1',
maxRetries: 1
});
dynamo.listTables(function(err, data){console.log(data)});
// > { TableNames: [ 'appaloosa' ] } But on the lambda with the export handler I get the timeout error. I've tried with the context fail and succeed var aws = require('aws-sdk');
exports.handler = function(event, context) {
var dynamo = new aws.DynamoDB({
region: 'eu-west-1',
maxRetries: 0
});
dynamo.listTables(function(err, data) {
if (err) {
context.fail(err.stack)
} else {
context.succeed('Function Finished! Data :' + data.TableNames);
}
});
};
It's a small database that I made for testing. It's the only one dynamodb table. And then the surprise. I've created a lambda and dynamo table in var aws = require('aws-sdk');
exports.handler = function(event, context) {
var dynamo = new aws.DynamoDB({
region: 'us-west-2',
maxRetries: 0
});
dynamo.listTables(function(err, data) {
if (err) {
context.fail(err.stack);
} else {
context.succeed('Function Finished! Data :' + data.TableNames);
}
});
}; I just changed the region and then The issue was related not to the region but to VPC. I remove all VPC configuration on But it's fixed. Thanks @chrisradek for your time. Feel free to close the issue. |
It was not easy to setup properly VPC for DynamoDB and lambda. This gist help me. https://gist.github.com/reggi/dc5f2620b7b4f515e68e46255ac042a7 |
I'm facing a very similar issue, and I suspect it could be related to this one. I'm trying to access DynamoDB from a Lambda that's inside a VPC, and it times out. Works fine if I remove the VPC, though. Would appreciate it if you could share what caused this issue and how it was solved. |
I'm new on AWS and I had a similar issue also, but it was not related with the VPC, tried to follow the tutorial that benoittgt gave, but it didn't work. The lambda timed out on the instatiation of the DynamoDB Client: It turns out that my lambda had only 128 MB of Memory allocated to the lambda. Once I passed it to 512MB it worked. This guy saved my life: Thanks |
@spbrds Yes. It works when increase the default memory from 128MB to 256MB, but it is really weird that the log says the Max Memory I have used is just 33MB. Quite annoying and painful with no clue about the lambda Logs. |
This also helped me.. I have to increase from 128 to 512MB to work with a Java8 Lambda... Again no error that I could see.. Very strange. |
Tried that and didn't work for me. Tried to launch the Lambda in a Private Subnet instead of a Public one and it works fine even with 128 MB Memory. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Original issue: #862 (comment)
Creating new issue so we don't pollute the conversation in #862.
@benoittgt
Can you set
maxRetries
to1
or0
? Also, is your Lambda function in the same region as your DynamoDB client? Do you have many tables to list? You could also try limiting the number of tables that get returned bylistTables
by settingLimit
to see if that's the issue.The text was updated successfully, but these errors were encountered: