adonisjs / mail

AdonisJS Email Provider
MIT License
102 stars 32 forks source link

Adonisjs v5 EmailTransportException: connect ECONNREFUSED 127.0.0.1:443 #54

Closed 4konung closed 4 years ago

4konung commented 4 years ago

Package version

Adonisjs v5

Node.js and npm version

Sample Code (to reproduce the issue)

Basically I've just copied from docs

await Mail.send((message) => {
          message
            .from('info@example.com')
            .to('user@example.com')
            .subject('Email address verification')
            .htmlView('emails/verification', data)
        })

When I try to send message I've got this error:

EmailTransportException: connect ECONNREFUSED 127.0.0.1:443
    at Function.apiFailure (/Users/mac-user/projects/api/node_modules/@adonisjs/mail/build/src/Exceptions/EmailTransportException.js:27:16)
    at MailgunTransport.send (/Users/mac-user/projects/api/node_modules/@adonisjs/mail/build/src/Transports/Mailgun.js:124:72)
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  response: {}
}
thetutlage commented 4 years ago

Do you have your connection config setup properly?

thetutlage commented 4 years ago

Closing since no response from the issue reporter and not actionable as well

4konung commented 4 years ago

Do you have your connection config setup properly?

Setup done step by step with this guide. I've even hardcoded API_KEY and domain into config file.

4konung commented 4 years ago

Tested with different templates of adonis v5 framework - API server and WEB Application. This error occurs only on API template (of course with installed @adonisjs/view).

Kuzzy commented 2 years ago

The reason of such errors is a got package, for example here:

https://github.com/adonisjs/mail/blob/develop/src/Transports/Mailgun.ts#L125

There are a lot of issues with got in other packages, the main reason of error is a number of libraries that are possibly in dependency tree that are monkey patching got client. In my case it was obsolete googleapis package. It was a really tricky to identify this problem.

Some references, to save someone else time: