-1

UnhandledPromiseRejectionWarning: Error: getaddrinfo ENOTFOUND api.sendgrid.com api.sendgrid.com:443 at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26) (node:6768) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:6768) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Varsha
  • 1
  • 1

1 Answers1

1

Please could you be more elaborate or better still add code snippet of your code for clearer understanding.

But from what I'm suspecting, I think there is an asynchronous call that you made that was not handled properly which might be that you didn't catch an error exception after the call. Always remember that transport.sednmail() is an asynchronous function and it returns a promise. See example below:

// With ".then" function
transport.sendMail(email)
  .then(response => console.log(response))
  .catch(error => console.log(error))


// With Callback function
transport.sendMail(email, (error, response) => {
   if(error) {
       console.log(error);
   }
   else{
       console.log(response);
   }
})

I hope this might be of little help to fixing the issue.

tMan44wiz
  • 126
  • 1
  • 5
  • The question you're trying to answer is poorly written and needs more details, therefore it should not be answered until the OP describes the issue in more detail. – Makdous May 26 '20 at 15:22