Sendgrid-nodejs: Unable to send email with @sendgrid/mail

Created on 2 Jul 2018  路  2Comments  路  Source: sendgrid/sendgrid-nodejs

Issue Summary

I"m using the hello world example to send an email. I have three firebase environments. It works in one but not the other two. They are paid environments and work to access Stripe (just to eliminate the response that my environments are not configured for external api acess).

The error I'm getting is

The header content contains invalid characters
    at ClientRequest.OutgoingMessage.setHeader (_http_outgoing.js:359:11)
    at new ClientRequest (_http_client.js:85:14)
    at Object.exports.request (http.js:31:10)
    at Object.exports.request (https.js:206:15)
    at Request.start (/user_code/node_modules/@sendgrid/mail/node_modules/request/request.js:747:32)
    at Request.write (/user_code/node_modules/@sendgrid/mail/node_modules/request/request.js:1492:10)
    at end (/user_code/node_modules/@sendgrid/mail/node_modules/request/request.js:545:18)
    at Immediate.<anonymous> (/user_code/node_modules/@sendgrid/mail/node_modules/request/request.js:574:7)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)

From googling it appears that it could be related to an older request/request#2632. Although I'm not sure why this would succeed on one env and fail on two others.

My best guess at this point is because @sendgrid/client uses request: ^2.81.0 which was released on Mar 9, 2017 (before this bug was reported), the bug is still present. Maybe updating the request dependency will fix the issue.

Technical details:

  • version: "@sendgrid/mail": "^6.3.1",
question

Most helpful comment

The issue was a simple copy and paste error. When I copied the API key to my second and third firebase environment I newline character was introduced. Which is exactly inline with the issue I referenced. as that key gets written to the header.

All 2 comments

The issue was a simple copy and paste error. When I copied the API key to my second and third firebase environment I newline character was introduced. Which is exactly inline with the issue I referenced. as that key gets written to the header.

Thanks for following up @ralphsmith80!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wooyah picture wooyah  路  4Comments

polkhovsky picture polkhovsky  路  3Comments

thinkingserious picture thinkingserious  路  4Comments

Loriot-n picture Loriot-n  路  4Comments

nicoasp picture nicoasp  路  3Comments