I created a netlify serverless function for connecting SMTP connecting on port 25.
The same implementation works properly when i tested on local using netlify dev.
But when I test in production, it give me below timeout error.:
2023-10-04T16:22:49.324Z 822fe534-b23f-4fa3-bb35-b327037e0d21 Task timed out after 10.01 seconds
I know that timeout limit is of 10 second for a function but my function hardly takes 3-5 seconds.
Kindly help and advice me on this.
Hi, @nitink.saas. We cannot debug what your function is doing for you. We recommend adding
console.time() statements to your function code to find out why it doesn’t complete in under 10 seconds.
We can also extend the function timeout for the site to a recommended maximum of 26 seconds.
If you would like us to make that timeout change or if there are other questions about this, please let us know.
Hi @luke ,
Please let me know if a function is allowing to connect to SMTP server on port 25?
I read in some other thread where you replied that it internally uses aws lambda so it wont allow.
Also, i tried these
console.time() as well. but the problem is function is taking time to connect to smtp server. I had put the log before and after execution of connection.
Please refer below code for your reference:
const socket = net.createConnection(25, smtpAddress);
Hi @hrishikesh ,
Thanks for clarification. I have already moved to some other solution. If anyone is still searching for solution, one can go with VPS option for this.
@luke Kindly delete your reply from this post so that other people can save their time: Can I send mail through SMTP from a function? - #4 by iwazaru. I went with your confirmation on that post informing that these ports are allowed. Thanks