在OpenWhisk中创建包操作,调用失败并显示错误消息

时间:2016-10-26 14:03:20

标签: ibm-cloud openwhisk

我正在按照OpenWhisk文档中的示例创建一个新的Package Action,详细here

运行wsk action invoke步骤,平台返回一个调用错误消息。

[10:57:58 /tmp/workshop]$ wsk action invoke --blocking --result packageAction --param lines '[ "and now", "for something completely", "different" ]'
{
    "error": "Initialization has failed due to: SyntaxError: Invalid or unexpected token
      at NodeActionRunner.init (/nodejsAction/runner.js:79:29)
      at doInit (/nodejsAction/src/service.js:134:31)
      at initCode (/nodejsAction/src/service.js:80:24)
      at /nodejsAction/app.js:62:13
      at Layer.handle [as handle_request] (/nodejsAction/node_modules/express/lib/router/layer.js:95:5)
      at next (/nodejsAction/node_modules/express/lib/router/route.js:131:13)
      at Route.dispatch (/nodejsAction/node_modules/express/lib/router/route.js:112:3)\n    at Layer.handle [as handle_request] (/nodejsAction/node_modules/express/lib/router/layer.js:95:5)\n    at /nodejsAction/node_modules/express/lib/router/index.js:277:22\n    at Function.process_params (/nodejsAction/node_modules/express/lib/router/index.js:330:12)"
}

出了什么问题?

1 个答案:

答案 0 :(得分:3)

Package Actions是该平台的新功能。

确保您拥有upgraded your OpenWhisk CLI最新版本以支持此功能。使用旧版本的cli来部署程序包操作时,可能会发生此错误。

您可以使用以下命令验证正在运行的CLI版本。

[14:49:21 /tmp/workshop]$ wsk property get
whisk auth      xxxx:xxx
whisk API host      openwhisk.ng.bluemix.net
whisk API version   v1
whisk namespace     user@host.com
whisk CLI version   2016-10-24T11:55:02+00:00
whisk API build     2016-10-24T12:04:22Z
whisk API build number  whisk-build-1260

确保CLI版本匹配或大于上述版本。

相关问题