Sea*_*ean 5 deployment node.js serverless
我正在使用无服务器来部署我的基于 Lambda 的应用程序。它部署得很好,然后由于某种原因停止了。我将整个包与下面的 serverless.yml 和处理程序中的一个函数配对 - 但我不断收到此错误:
Serverless Error ---------------------------------------
An error occurred: TestLambdaFunction - Value of property Variables must be an object with String (or simple type) properties.
Stack Trace --------------------------------------------
Run Code Online (Sandbox Code Playgroud)
这是 serverless.yml
# serverless.yml
service: some-api
provider:
name: aws
runtime: nodejs6.10
stage: prod
region: us-east-1
iamRoleStatements:
$ref: ./user-policy.json
environment:
config:
region: us-east-1
plugins:
- serverless-local-dev-server
- serverless-dynamodb-local
- serverless-step-functions
package:
exclude:
- .gitignore
- package.json
- README.md
- .git
- ./**.test.js
functions:
test:
handler: handler.test
events:
- http: GET test
resources:
Outputs:
NewOutput:
Description: Description for the output
Value: Some output value
Run Code Online (Sandbox Code Playgroud)
测试包中的 Lambda 函数
#handler.test
module.exports.test = (event, context, callback) => {
callback(null, {
statusCode: 200,
body: JSON.stringify({
message: 'sadfasd',
input: event
})
})
}
Run Code Online (Sandbox Code Playgroud)
Sea*_*ean 12
事实证明,这个问题与 Lambda 函数没有任何关系。这是导致错误的问题。
但这不工作:
environment:
config:
region: us-east-1
Run Code Online (Sandbox Code Playgroud)
这确实有效:
environment:
region: us-east-1
Run Code Online (Sandbox Code Playgroud)
简而言之,我认为您的 yaml 环境变量中不能有多个级别。
即使您尝试sls print进行健全性检查,也不会弹出此问题。仅在sls deploy.
您已收到警告,希望能得救!
| 归档时间: |
|
| 查看次数: |
9749 次 |
| 最近记录: |