I am integrating SendGrid. If I leave the code as embedded JS, everything is fine. Once I modify it to be coffeescript, I get an error. I think it’s an issue with the msg
data when I call sgMail.send(msg).
My server code is here:
sendEmail: (to) ->
sgMail = require('@sendgrid/mail')
sgMail.setApiKey(process.env.SENDGRID_API_KEY)
msg =
to: to
from: 'test@example.com'
subject: 'Sending with SendGrid is Funny'
text: 'and easy to do anywhere, even with Node.js'
html: '<strong>and easy to do anywhere, even with Node.js</strong>'
sgMail.send(msg)
Error is here:
W20190305-07:41:02.571(-8)? (STDERR) (node:83322) UnhandledPromiseRejectionWarning: RangeError: Maximum call stack size exceeded
W20190305-07:41:02.572(-8)? (STDERR) at Array.map (<anonymous>)
W20190305-07:41:02.572(-8)? (STDERR) at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:575:14)
W20190305-07:41:02.572(-8)? (STDERR) at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)
W20190305-07:41:02.572(-8)? (STDERR) at Array.forEach (<anonymous>)
W20190305-07:41:02.572(-8)? (STDERR) at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)
W20190305-07:41:02.572(-8)? (STDERR) at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)
W20190305-07:41:02.572(-8)? (STDERR) at Array.forEach (<anonymous>)
W20190305-07:41:02.572(-8)? (STDERR) at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)
W20190305-07:41:02.573(-8)? (STDERR) at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)
W20190305-07:41:02.573(-8)? (STDERR) at Array.forEach (<anonymous>)
W20190305-07:41:02.573(-8)? (STDERR) at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)
W20190305-07:41:02.573(-8)? (STDERR) at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)
W20190305-07:41:02.573(-8)? (STDERR) at Array.forEach (<anonymous>)
W20190305-07:41:02.573(-8)? (STDERR) at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)
W20190305-07:41:02.573(-8)? (STDERR) at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)
W20190305-07:41:02.573(-8)? (STDERR) at Array.forEach (<anonymous>)
W20190305-07:41:02.574(-8)? (STDERR) (node:83322) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
W20190305-07:41:02.574(-8)? (STDERR) (node:83322) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.