node.js使用sendgrid npm模块时出现未处理的promise拒绝错误



原因可能是什么?节点给了我未处理的承诺拒绝错误代码出了什么问题。

已成功要求sendgrid模块,并且已正确设置sendgrid API密钥,但代码仍然给我错误。


sgMail.send({
to: 'somebody@gmail.com',
from: 'somebodygmail.com',
subject: 'This is my first creation!',
text: 'I hope this one actually get to you'
})

尝试使用:

sgMail.send({
to: 'somebody@gmail.com',
from: 'somebodygmail.com',
subject: 'This is my first creation!',
text: 'I hope this one actually get to you'
}).then(out=>console.log(out)).catch(e=>console.log(e))

您将能够识别错误。如果没有,则将日志发布到问题中。

编辑:

可能的原因:

电子邮件中的是无效的

相关内容

最新更新