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.
"@sendgrid/mail": "^6.3.1",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!
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.