0
votes

I had sent a series of emails today with Sendgrid successfully. It was a mass number of emails (mass user creation with emails attached to each successfully created email). Everything went well and the emails were received. However, most of the emails were fake, for testing purposes only (e.g. [email protected]). But there would usually be at least one real email to see that they actually sent.

After a while, I started receiving the below error that would crash my server whenever any email was sent. I checked the SendGrid docs but it only tells you what different error codes mean. I did not receive an error code which is why I am taking this to stackoverflow.

/home/me/websites/emailtester/node_modules/@sendgrid/helpers/classes/response-error.js:45
[0]     if (Array.isArray(body.errors)) {
[0]                           ^
[0]
[0] TypeError: Cannot read property 'errors' of undefined
[0]     at ResponseError.toString (/home/me/websites/emailtester/node_modules/@sendgrid/helpers/classes/response-error.js:45:27)
[0]     at Function.prepareStackTrace (/home/me/websites/emailtester/node_modules/source-map-support/source-map-support.js:377:16)
[0]     at new ResponseError (/home/me/websites/emailtester/node_modules/@sendgrid/helpers/classes/response-error.js:30:14)
[0]     at Request.http [as _callback] (/home/me/websites/emailtester/node_modules/@sendgrid/client/src/client.js:124:25)
[0]     at Request.self.callback (/home/me/websites/emailtester/node_modules/request/request.js:186:22)
[0]     at emitTwo (events.js:125:13)
[0]     at Request.emit (events.js:213:7)
[0]     at Request.<anonymous> (/home/me/websites/emailtester/node_modules/request/request.js:1163:10)
[0]     at emitOne (events.js:115:13)
[0]     at Request.emit (events.js:210:7)
[0]     at IncomingMessage.<anonymous> (/home/me/websites/emailtester/node_modules/request/request.js:1085:12)
[0]     at Object.onceWrapper (events.js:314:30)
[0]     at emitNone (events.js:110:20)
[0]     at IncomingMessage.emit (events.js:207:7)
[0]     at endReadableNT (_stream_readable.js:1045:12)
[0]     at _combinedTickCallback (internal/process/next_tick.js:138:11)
[0]     at process._tickDomainCallback (internal/process/next_tick.js:218:9)
[0] [nodemon] app crashed - waiting for file changes before starting...

Has anyone else ever come across this error? Is this is issue with my code or is this something relating to SendGrid itself?

1
body is undefined, not errors. - BenM
I noticed that, but I haven't change the structure of my emails and all of my emails are affected equally. I am unsure what the body that sendgrid is wanting to receive is referring to? - Brandon

1 Answers

0
votes

I didn't do anything but it now works.

On the weekend I tried it out again and emails wouldn't send but today, emails send as expected.

I wonder if this is an error with sendgrid itself since the problem appeared as mysteriously as it appeared.