gpt4 book ai didi

无服务器错误 - 没有文件匹配包含/排除模式

转载 作者:行者123 更新时间:2023-12-04 16:25:15 25 4
gpt4 key购买 nike

我正在尝试使用 python 进行一些骨架部署。这是我的 serverless.yaml
我的文件夹结构是

serverless-test
|_lambdas
|____handler.py
|_layers
|____common
|_________somefunction.py
service: serverless-test

frameworkVersion: '2'

provider:
name: aws
runtime: python3.8
lambdaHashingVersion: 20201221

stage: test
region: us-west-2

functions:
hello:
handler: lambdas/handler.hello
这工作正常。现在,只要我添加一个图层,就会出现以下错误 No file matches include / exclude patterns
service: serverless-test

frameworkVersion: '2'

provider:
name: aws
runtime: python3.8
lambdaHashingVersion: 20201221

stage: test
region: us-west-2

functions:
hello:
handler: lambdas/handler.hello
layers:
- {Ref: CommonLambdaLayer}

layers:
common:
path: layers/common
name: common-module
description: common set of functions
我还尝试添加包含和排除模式。但这并没有解决我的问题
service: serverless-test

frameworkVersion: '2'

provider:
name: aws
runtime: python3.8
lambdaHashingVersion: 20201221

stage: test
region: us-west-2

package:
individually: true
exclude:
- ./**
include:
- ./lambdas/**

functions:
hello:
handler: lambdas/handler.hello
layers:
- {Ref: CommonLambdaLayer}

layers:
common:
path: layers/common
name: common-module
description: common set of functions
package:
include:
- ./**
我也尝试非常具体
service: serverless-test

frameworkVersion: '2'

provider:
name: aws
runtime: python3.8
lambdaHashingVersion: 20201221

stage: test
region: us-west-2

package:
individually: true
exclude:
- ./**

functions:
hello:
handler: lambdas/handler.hello
layers:
- {Ref: CommonLambdaLayer}
package:
exclude:
- ./**
include:
- ./lambdas/handler.py

layers:
common:
path: layers/common
name: common-module
description: common set of functions
package:
exclude:
- ./**
include:
- ./layers/common/somefunction.py

最佳答案

我遇到了同样的问题并找到了这个答案 here :

serverless is checking those files against the patterns specified in the root package:exclude and because./** matches every file and the include-pattern./functions/**/* matches none, no files are actually included in the layer, which causes the error.


只需尝试删除 ./**从排除:
package:
individually: true
exclude:
- ./** # <-- remove this!

关于无服务器错误 - 没有文件匹配包含/排除模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66001173/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com