0
I am trying to connect to a RDS instance from a lambda. I made and tested the lambda locally, it worked perfectly. However, when I deploy to AWS the code is normally executed until the part where the connection to the bank is made. From this, not even log messages appear.
Note: I am using context.callbackWaitsForEmptyEventLoop = false;
Note: I am not using VPC in lambda.
Obs3: I have older planes that work normal, only the new ones are with this problem, even if the configurations are the same.
This is the relevant part of the code:
if (body && body.modality_id) {
console.log('Just debugging...')
DB.query("call sp_create_transaction (?)",[body.modality_id])
.then(results => {
if (results[0][0]) {
if (results[0][0].Error) {
helper.body = { 'message': results[0][0].Error };
console.log('Error:' + results[0][0].Error);
}
else {
helper.statusCode = 200;
helper.body = results[0];
console.log(helper.body);
console.log('EXECUTION SUCCESS:');
}
}
else {
helper.statusCode = 401;
helper.body = { 'message': 'Falha ao buscar taxas.' };
console.log('Error: Rates not found.');
}
callback(null, helper.response);
})
.catch(err => {
helper.statusCode = 500;
helper.body = { 'message': 'Por favor, informa ao time de suporte técnico o código DAN-54.' };
console.log('Error: DAN-54');
console.log(err);
callback(null, helper.response);
});
}
Here is the log output:
START RequestId: fb134979-7d0e-4fa3-b7c8-4192f4765ea8 Version: $LATEST
2019-05-28T23:47:26.609Z fb134979-7d0e-4fa3-b7c8-4192f4765ea8 INFO Just debugging...
END RequestId: fb134979-7d0e-4fa3-b7c8-4192f4765ea8
REPORT RequestId: fb134979-7d0e-4fa3-b7c8-4192f4765ea8 Duration: 1273.33 ms Billed Duration: 1300 ms Memory Size: 128 MB Max Memory Used: 79 MB
I accidentally saved the incomplete answer and already took a negative :'(
– Krismorte
Solved the problem ;)
– Jakson Fischer
Thanks @Jaksonfischer soon I plan to upload a lambda example code by accessing RDS on my github, I haven’t had time yet. Put the link here for staff to follow the documentation and very flawed then and example that we get the https://github.com/krismorte thing
– Krismorte
Opa, this is always good. Unfortunately here are a people who is with the finger ready to negative, but give a vote in favor, necas... Unfortunately we suffer a lot from it, but there’s nothing to do :/
– Jakson Fischer