我创建了一个示例演示站点,并尝试在 IBM Openwhisk 平台上使用无服务器部署进行部署。我收到以下错误消息,但无法找出导致问题的原因。
由于错误而无法部署函数 (myPackage):PUT https://api.ng.bluemix.net/api/v1/namespaces/_/actions/myPackage?overwrite=true Returned HTTP 500 (Internal Server Error) --> “响应缺少错误消息。”
我的 handler.js 代码
const serverless = require("serverless-http");
const hbs = require("hbs");
const express = require("express");
const bodyParser = require("body-parser");
const app = express();
app.use(bodyParser.urlencoded({ extended: false }));
// parse application/json
app.use(bodyParser.json());
app.set("view engine", "hbs");
app.get("/", function(req, res) {
res.status(200).render("index");
});
module.exports.openwhisksauce= serverless(app);
我的 serverless.yml 代码:
service: openwhisksauce
provider:
name: openwhisk
runtime: nodejs:10.3.0
functions:
app:
handler: handler.openwhisksauce
# The `events` block defines how to trigger the http events
name: "myPackage"
events:
- http: ANY /
- http: 'ANY {proxy+}'
# remember to run npm install to download the provider plugin.
plugins:
- serverless-openwhisk