Sendgrid-nodejs: require(...).SendGrid 不是函数

创建于 2016-08-09  ·  3评论  ·  资料来源: sendgrid/sendgrid-nodejs

问题摘要

_为 Node.js 使用 v3 邮件。_

在 v3 Mail 的文档中,在“Node.js”代码示例下,您在 _line 11_ 上指定要编写

var sg = require('sendgrid').SendGrid(process.env.SENDGRID_API_KEY)

然而,当我做时,收到TypeError: require(...).SendGrid is not a function在之间的时间段与一个指针^(克拉) )SendGrid(process.env.SENDGRID_API_KEY)

但是,当我这样做时...

const sendGrid = require('sendgrid')(process.env.SENDGRID_API_KEY); //removing the .SendGrid method
console.log('sendGrid: ', sendGrid);

我没有收到任何错误,我可以成功发送电子邮件。

如果我遗漏了什么,请告诉我,但是,如果我没有遗漏,您可以考虑更新您的文档以消除未来的混乱。

聚苯乙烯

SendGrid 很棒。 继续做好工作。
-托比亚雷克斯

  • sendgrid-nodejs 版本:master(最新提交:0df1613)
  • Node.js 版本:6.2.1
help wanted bug

最有用的评论

我已更新代码示例以匹配此库的新更新: https :

最近有一个重大更改,我未能更新 docs.sendgrid.com 上的文档。

再次感谢!

所有3条评论

你好@TobiahRex

感谢您的提醒!

我们将深入研究并进行适当的修复。

我已更新代码示例以匹配此库的新更新: https :

最近有一个重大更改,我未能更新 docs.sendgrid.com 上的文档。

再次感谢!

@thinkingserious ,

很高兴听到您能够进行必要的更改。 谢谢回复!

-托比

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

amlcodes picture amlcodes  ·  4评论

thinkingserious picture thinkingserious  ·  4评论

mikemaccana picture mikemaccana  ·  4评论

umarhussain15 picture umarhussain15  ·  3评论

prasoonjalan picture prasoonjalan  ·  3评论