Webtask + Sendgrid =编译失败?

时间:2017-10-20 15:58:45

标签: node.js sendgrid webtask

通过webtask.io运行:

var sgMail = require("@sendgrid/mail");
module.exports = function(context, req, res) {
  res.writeHead(200, { 'Content-Type': 'text/html '});
  res.end('<h1>Hello, world!</h1>');
};

此回复的结果:

{
 "code": 400,
 "message": "Compilation failed: Unexpected token {",
 "error": "Unexpected token {",
 "stack": "SyntaxError: Unexpected token {\n    at 
   exports.runInThisContext (vm.js:53:16)\n    at Module._compile 
   (module.js:373:25)\n    at Module._compile 
   (/data/sandbox/lib/module.js:127:21)\n    at 
   Object.Module._extensions..js (module.js:416:10)\n    at Module.load 
   (module.js:343:32)\n    at Function.Module._load 
   (module.js:300:12)\n    at WebtaskModule.require 
   (/data/sandbox/lib/module.js:101:19)\n    at require 
   (/data/sandbox/lib/module.js:136:21)\n    at Object.<anonymous> 
   (/data/io/3bd979bebf074788b6849906721a8b06/webtask.js:2:14)\n    at 
   WebtaskModule.compileWebtask (/data/sandbox/lib/module.js:95:34)"
}

如果我注释掉@sendgrid/mail模块,一切运行正常。 (是的,我已将模块添加到webtask中。)

是我,模块还是webtask?

1 个答案:

答案 0 :(得分:1)

这将在2018年与@sendgrid/mail@6.3.1一起使用。