问题描述
在我的云功能中:
const app = express();
app.use(multer().array());
app.post("/",(req,res) => {
console.log("hit",req.body.from);
console.log("hit",req.body.from);
return res.sendStatus(200);
});
const emailInboundWebhook = functions.https.onRequest(app);
module.exports = {
emailInboundWebhook
}
我在日志中得到了
i functions: Beginning execution of "emailInboundWebhook"
> hit undefined
> hit undefined
i functions: Finished "emailInboundWebhook" in ~1s
但是当同一终结点充当Express应用程序(外部云功能)时:
const express = require("express");
const app = express();
const multer = require('multer');
app.get("/",async (req,res) => {
res.status(200).json({foo: "Bar"});
})
app.use(multer().array());
app.post("/webhook",req.body.to);
console.log("hit",req.body.from);
res.sendStatus(200);
});
app.listen(80,() => {
console.log("App listening on 80");
})
为此:
hit a@some-email-inbound.some.url
hit Rahul Priyadarsi <myemailid@gmail.com>
这两个结果是针对发送相同的电子邮件,这些功能作为sendgrid webhooks触发,它们发送multipart/form-data
POST请求,其中包含从a@some-email-inbound.some.url
发送到myemailid@gmail.com
的电子邮件的详细信息
我不知道为什么两个结果不同(我正在通过ngrok对其进行测试,并且由于控制台日志行已运行,因此显然该功能已被击中)。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)