Error: read ECONNRESET at TLSWrap.onStreamRead

自闭症网瘾萝莉.ら 提交于 2021-01-27 14:11:55

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/56488085/error-read-econnreset-at-tlswrap-onstreamread

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!