部署功能失败

时间:2018-06-27 09:52:41

标签: ibm-cloud serverless-framework serverless openwhisk ibm-cloud-functions

我已经创建了一个示例演示站点,并尝试使用无服务器部署在IBM Openwhisk平台上进行部署。我收到以下错误消息,无法弄清楚是什么原因引起的。

由于以下错误而无法部署功能(myPackage):PUT https://api.ng.bluemix.net/api/v1/namespaces/_/actions/myPackage?overwrite=true返回了HTTP 500(内部服务器错误)->“响应缺少错误消息。”

我的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

1 个答案:

答案 0 :(得分:0)

有许多问题阻止此工作。

  • runtime: nodejs:10.3.0 IBM Cloud Functions不支持此运行时。使用nodejs:8

  • - http: ANY / IBM Cloud Functions API网关不支持ANY方法。替换为有效的HTTP动词。

  • https://github.com/dougmoscrop/serverless-http期望在AWS Lambda上运行,并使用AWS特定的运行时和事件属性。这不适用于IBM Cloud Functions。

有一个不同的项目来使Express.js应用程序在IBM Cloud Functions上运行。有关详细信息,请参见此回购...

https://github.com/IBM/expressjs-openwhisk

相关问题