0

使用以下命令安装无服务器时 sls plugin install -n serverless-alexa-skills --stage dev

我收到一个错误,例如Your serverless.yml has an invalid value with key: "Ref"

以下是我的示例 serverless.yml 文件

plugins:
- serverless-webpack
- serverless-s3-sync
- serverless-plugin-git-variables
- serverless-alexa-skills

functions: ${file(./deploy/${opt:stage}.yml):functions}
resources: ${file(./deploy/${opt:stage}.yml):resources}
custom: ${file(./deploy/${opt:stage}.yml):custom}

outputs:
DialogflowFunctionArn:
Value:
  Ref: 

这里有块。有人可以在这里帮助我吗?

4

3 回答 3

2

Ref 是 Cloudformation 内在函数。它需要引用资源。整个outputs部分也是可选的,仅当您需要在另一个堆栈中引用资源时才使用它。

于 2019-01-21T18:31:01.200 回答
1

它基本上说 Ref: 期待一个值。您已经定义了它,但没有为其分配任何值。如果没有用,那么您应该从代码中删除这部分:

outputs:
DialogflowFunctionArn:
Value:
  Ref:
于 2019-01-21T20:30:33.050 回答
0

Ref 期望引用一些东西,现在你没有传递任何东西来引用。

因此,假设您想要 DialogflowFunction 的 ARN,并且该函数配置在您的函数文件中看起来像这样:

DialogflowFunction:
  description: get the flow
  handler: src/functions/dialog-controller.flow
  events:
    - http:
        path: '/dialog/flow'
        method: get
        cors: true

然后你的 ref 看起来像这样:

outputs:
DialogflowFunctionArn:
Value:
  Ref: DialogflowFunction

Ref获取要引用的资源的逻辑 ID,在本例中为DialogflowFunction,并将返回该资源的 ARN。

于 2019-01-21T21:53:15.523 回答