DEV Community

Discussion on: Sending Emails Securely Using Node.js, Nodemailer, SMTP, Gmail, and OAuth2

Collapse
 
kotwani2883 profile image
Palak Kotwani

I am getting this error . UnhandledPromiseRejectionWarning: Failed to create access token :(
(Use node --trace-warnings ... to show where the warning was created)
(node:7900) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see nodejs.org/api/cli.html#cli_unhand...). (rejection id: 1)
(node:7900) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise

Collapse
 
typicoul profile image
Luteya Coulston

I'm getting the same, did you find a solution?

Collapse
 
nokha_debbarma profile image
Nokha Debbarma • Edited

As sendEMail is a async function try adding try-catch block inside sendEmail function.

Thread Thread
 
sailee14 profile image
sailee14

After adding try catch block getting "Error: No refresh token or refresh handler callback is set." this error. Any way to make it right?

Collapse
 
nokha_debbarma profile image
Nokha Debbarma

As sendEMail is a async function try add try-catch block inside sendEmail function.