serverless-forms icon indicating copy to clipboard operation
serverless-forms copied to clipboard

Handle SMTP timeout more gracefully

Open tinloaf opened this issue 11 months ago • 1 comments

Hi,

first: thanks for building this. :)

I'm trying to use it (in the form of the docker container published to docker hub), and during my testing, my SMTP server was temporarily unavailable. This is what I see in my docker logs:

/app/node_modules/nodemailer/lib/smtp-connection/index.js:557
            err = new Error(message);
                  ^

Error: Connection timeout
    at SMTPConnection._formatError (/app/node_modules/nodemailer/lib/smtp-connection/index.js:557:19)
    at SMTPConnection._onError (/app/node_modules/nodemailer/lib/smtp-connection/index.js:530:20)
    at Timeout.<anonymous> (/app/node_modules/nodemailer/lib/smtp-connection/index.js:248:18)
    at listOnTimeout (node:internal/timers:594:17)
    at process.processTimers (node:internal/timers:529:7) {
  code: 'ETIMEDOUT',
  command: 'CONN'

}

After that, the whole application seems to be gone or hanging.

I think it would probably be good to have a couple of retries on a timeout, but at the least, the application should not crash, right?

tinloaf avatar Jan 05 '25 14:01 tinloaf

Aouch, yes definitely, good catch, thank you :) Would you help with a PR? I can guide you maybe

lexoyo avatar Jan 06 '25 05:01 lexoyo