Hi
I've some problems using the SES and Cognito services in some Lambda Functions (Runtime NodeJs 12.x).
A lot of times the lambda go on timeout around 10 times before giving me a successful response.
I also use another service (RDS w/AuroraDB) but this one never gave me problems.
I think the way I use them is correct because, after the first tries, the lambda reach the end.
//SES CODE
//DECLARATION
const ses = new AWS.SES({region: "eu-central-1"});
//{...}
//SES REQUEST
try{
const sesRes = await ses.sendRawEmail(emailParams).promise(); //<- GET STUCK HERE
console.log();
return {
isBase64Encoded: false,
statusCode: 204,
headers:{
'Access-Control-Allow-Origin' : '*',
},
body: null
};
}catch (err){
return {
isBase64Encoded: false,
statusCode: 401,
headers:{
'Access-Control-Allow-Origin' : '*',
},
body: JSON.stringify({
message: "FINAL DB error",
error: err})
};
}
}
//COGNITO CODE
//DECLARATION
const cognitoPool = new Aws.CognitoIdentityServiceProvider({region: "eu-central-1"});
// {..}
//COGNITO REQUEST
try{
await cognitoPool.adminCreateUser(params).promise(); //<- GET STUCK HERE
await cognitoPool.adminAddUserToGroup({
GroupName: userGroup,
Username: userInfo.email,
UserPoolId: process.env.USERPOOL,
}).promise();
}catch(err){
return {
isBase64Encoded: false,
statusCode: 401,
headers:{
'Access-Control-Allow-Origin' : '*',
},
body: JSON.stringify({
error: err.code,
})
};
}