Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Deep email validator in the aws cloud shell / Lambda not working #76

Open
sairaja opened this issue Oct 5, 2023 · 4 comments
Open

Deep email validator in the aws cloud shell / Lambda not working #76

sairaja opened this issue Oct 5, 2023 · 4 comments

Comments

@sairaja
Copy link

sairaja commented Oct 5, 2023

I'm unable to run the deep email validator in the aws cloud shell / Lambda.

Please suggest.

Getting SMTP timeout / SMTP false.

Below is the code used.

const emailValidator = require('deep-email-validator');

// Get the email address from command-line arguments
const emailToValidate = process.argv[2];

async function validateEmail(email) {
try {
const { valid, reason, validators, address } = await emailValidator.validate(email);
console.log('validating smtp',validators?.smtp.valid)
if (valid) {
console.log(Email ${email} is valid and deliverable.);
// Proceed with sending the email
} else {
console.error(Email ${email} is not valid. Reason: ${reason});
// Handle the case where the email address is not valid
}
} catch (error) {
console.error(An error occurred while validating the email: ${error.message});
// Handle the error (e.g., log it or show an error message)
}
}

if (!emailToValidate) {
console.error('Usage: node validateEmail.js ');
process.exit(1);
}

validateEmail(emailToValidate);

This works completely fine in the local environment.
But fails in AWS Cloud Shell or AWS Lambda.

Please look into this issue.

@sairaja sairaja changed the title Deep email validator in the aws cloud shell / Lambda Deep email validator in the aws cloud shell / Lambda not working Oct 5, 2023
@PaulSpaurgen
Copy link

Hi sairaja, I am also facing the same issue did you find any solution ?

@arobida-adzz
Copy link

arobida-adzz commented Jan 7, 2024

not sure if it will work but I have found using keepAlive fixes issues with lambadas that make external api calls:

{
httpAgent: new http.Agent({ keepAlive: true, keepAliveMsecs: 10000 }),
httpsAgent: new https.Agent({ keepAlive: true, keepAliveMsecs: 10000 }),
timeout: 5000
}

@sfarkas1988
Copy link

aws does not allow 25 outbound calls which is needed for smtp checks.
I just found out after a full day of debugging.
I.e: https://repost.aws/questions/QUhOiYfU2ESzyjHNFLdih5lQ/smtp-port-25-outgoing-connections-blocked

@AshleyJackson
Copy link

aws does not allow 25 outbound calls which is needed for smtp checks. I just found out after a full day of debugging. I.e: https://repost.aws/questions/QUhOiYfU2ESzyjHNFLdih5lQ/smtp-port-25-outgoing-connections-blocked

This is what i've found as well while building Lambda's using AWS SST. Thanks @sfarkas1988

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants