【问题标题】:serverless-openwhisk Package Configuration does not include filesserverless-openwhisk 包配置不包含文件
【发布时间】:2018-07-01 13:14:40
【问题描述】:

我正在尝试使用无服务器框架单独打包我的 openwhisk 操作。我的操作只是打印出“./”中的所有文件和目录

我的问题是,我在任何地方都找不到包含的文件“workflow.js”和“workflow.json”。他们甚至包括在内吗? src 目录也不包含文件,它只包含一个名为“service.js”的文件

"2018-07-01T12:43:39.856352769Z stdout: .dockerignore",
"2018-07-01T12:43:39.856367445Z stdout: 5u3RVNXU",
"2018-07-01T12:43:39.856373403Z stdout: CHANGELOG.md",
"2018-07-01T12:43:39.856379151Z stdout: README.md",
"2018-07-01T12:43:39.856385821Z stdout: Vr6M5n51",
"2018-07-01T12:43:39.8566812Z   stdout: app.js",
"2018-07-01T12:43:39.856696174Z stdout: node_modules",
"2018-07-01T12:43:39.856702235Z stdout: package-lock.json",
"2018-07-01T12:43:39.856707997Z stdout: package.json",
"2018-07-01T12:43:39.856714673Z stdout: runner.js",
"2018-07-01T12:43:39.856974881Z stdout: src"

我的 serverless.yml 看起来像这样:

service: private-cloud

provider:
  name: openwhisk
  versionFunctions: false
  stage: ${opt:stage, 'dev'}

package:
  individually: true
  exclude:
    - ./**
  include:
    - node_modules/**
    - workflow.js
    - workflow.json

functions:
  action1:
    handler: handler1.hello
    name: action1Handler
    package:
      include:
        - handler1.js
  action2:
    handler: handler2.hello
    name: action2Handler
    package:
      include:
        - handler2.js
    events: # All events associated with this function
      - http: POST /api/${self:functions.action2.name}
  action3:
    handler: handler3.hello
    name: action3Handler
    package:
      include:
        - handler3.js
  action4:
    handler: handler4.hello
    name: action4Handler
    package:
      include:
        - handler4.js
  action5:
    handler: handler5.hello
    name: action5Handler
    package:
      include:
        - handler5.js
    events: # All events associated with this function
      - http: POST /api/${self:functions.action5.name}

# Add the serverless-openwhisk plugin
# https://github.com/serverless/plugins
plugins:
  - serverless-openwhisk

【问题讨论】:

  • 你的问题是什么?

标签: serverless-framework openwhisk


【解决方案1】:

有一个已知问题打开https://github.com/apache/incubator-openwhisk-runtime-nodejs/issues/57

要从 zip 中查找 src 的根目录,请使用 nodejs 变量 __dirname

喜欢 让 filePath = __dirname + “/workflow.json”

【讨论】:

  • 谢谢!!这很有帮助。不幸的是,该目录仅包含其中一个文件,即 JS 文件。另一个是 JSON,不包括在内。但我猜这更多是无服务器框架的问题。
  • 我发现了问题 :) 它在我身边。再次感谢 csantanapr
猜你喜欢
  • 2015-08-02
  • 2019-12-26
  • 2010-10-15
  • 1970-01-01
  • 2013-05-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-05-29
相关资源
最近更新 更多