_Using v3 Mail for Node.js._
In your documentation for v3 Mail, under "Node.js" code examples, you specify on _line 11_, to write
var sg = require('sendgrid').SendGrid(process.env.SENDGRID_API_KEY)
however, when I do, i receive TypeError: require(...).SendGrid is not a function
with a pointer ^ (carat) at the period between )
and SendGrid(process.env.SENDGRID_API_KEY)
.
However, when I do this...
const sendGrid = require('sendgrid')(process.env.SENDGRID_API_KEY); //removing the .SendGrid method
console.log('sendGrid: ', sendGrid);
I receive NO error's and I can successfully send an email.
Please let me know if I have missed something, however, if I have not, you may consider updating your documentation to remove future confusion.
P.S.
SendGrid is awesome. Keep doin' good work.
-Tobiah Rex
Hello @TobiahRex,
Thanks for the heads up!
We'll dig in and make the appropriate fixes.
I have updated the code example to match the new updates to this library: https://sendgrid.com/docs/Integrate/Code_Examples/v3_Mail/nodejs.html
There was a recent breaking change and I failed to update the docs at docs.sendgrid.com.
Thanks again!
Hi @thinkingserious,
Awesome to hear you were able to make the necessary changes. Thanks for the reply!
-Toby
Most helpful comment
I have updated the code example to match the new updates to this library: https://sendgrid.com/docs/Integrate/Code_Examples/v3_Mail/nodejs.html
There was a recent breaking change and I failed to update the docs at docs.sendgrid.com.
Thanks again!