Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: read ECONNRESET at TLSWrap.onStreamRead

I am trying to send an email in my nodejs app using @sendgrid/email library but when I try to send an email I am getting the following error:

{ Error: read ECONNRESET at TLSWrap.onStreamRead (internal/stream_base_commons.js:111:27) errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' }


I tried the following code please have a look.

const sgMail = require('@sendgrid/mail');
sgMail.setApiKey('***************************'); // API KEY
sgMail.send({
  to: email,
  from: 's*****@gmail.com',
  subject: 'signup succeeded!',
  html: '<h1>You Successfully Signed Up!</h1>'
})

How do I fix this issue?

like image 762
Swaroop Babaleshwar Avatar asked Jul 04 '26 21:07

Swaroop Babaleshwar


1 Answers

Check if you are behind proxy. This error occurs when your sending machine is not able to connect to sendgrid api server.

like image 123
Rahul Avatar answered Jul 07 '26 11:07

Rahul



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!