Я следовал учебнику https://serverless -stack.com / и разделил свой код на несколько сервисов.
Теперь, когда я развертываю его с помощью seed.run, я могу развернуть только службы баз данных (табели). Первый этап развертывания. Когда я попадаю в службы лямбды, я получаю сообщение об ошибке «Нет совпадений файлов, включая / исключают шаблоны»
Я пытался добавить службы с разными типами путей, например / services / service /, services / service и т. Д. Я также пытался развернуть только некоторые лямбда-функции с одинаковыми результатами.
сервис: app-api-notes
custom:
# Our stage is based on what is passed in when running serverless
# commands. Or fallsback to what we have set in the provider section.
stage: ${opt:stage, self:provider.stage}
provider:
name: aws
runtime: nodejs8.10
stage: dev
region: eu-west-1
# These environment variables are made available to our functions
# under process.env.
environment:
tableName:
${file(../database/notes/serverless.yml):custom.tableName}
iamRoleStatements:
- Effect: Allow
Action:
- dynamodb:DescribeTable
- dynamodb:Query
- dynamodb:Scan
- dynamodb:GetItem
- dynamodb:PutItem
- dynamodb:UpdateItem
- dynamodb:DeleteItem
# Restrict our IAM role permissions to
# the specific table for the stage
Resource:
- 'Fn::ImportValue': ${self:custom.stage}-NotesTableArn
functions:
# Defines an HTTP API endpoint that calls the main function in
create.js
# - path: url path is /notes
# - method: POST request
# - cors: enabled CORS (Cross-Origin Resource Sharing) for browser
cross
# domain api call
# - authorizer: authenticate using the AWS IAM role
create:
handler: create.main
events:
- http:
path: notes
method: post
cors: true
authorizer: aws_iam
get:
# Defines an HTTP API endpoint that calls the main function in
get.js
# - path: url path is /notes/{id}
# - method: GET request
handler: get.main
events:
- http:
path: notes/{id}
method: get
cors: true
authorizer: aws_iam
list:
# Defines an HTTP API endpoint that calls the main function in
list.js
# - path: url path is /notes
# - method: GET request
handler: list.main
events:
- http:
path: notes
method: get
cors: true
authorizer: aws_iam
update:
# Defines an HTTP API endpoint that calls the main function in
update.js
# - path: url path is /notes/{id}
# - method: PUT request
handler: update.main
events:
- http:
path: notes/{id}
method: put
cors: true
authorizer: aws_iam
delete:
# Defines an HTTP API endpoint that calls the main function in
delete.js
# - path: url path is /notes/{id}
# - method: DELETE request
handler: delete.main
events:
- http:
path: notes/{id}
method: delete
cors: true
authorizer: aws_iam
resources:
Outputs:
ApiGatewayRestApiId:
Value:
Ref: ApiGatewayRestApi
Export:
Name: ${self:custom.stage}-ApiGatewayRestApiId
ApiGatewayRestApiRootResourceId:
Value:
Fn::GetAtt:
- ApiGatewayRestApi
- RootResourceId
Export:
Name: ${self:custom.stage}-ApiGatewayRestApiRootResourceId
Я ожидаю, что лямбда-сервис будет развернут, но вместо этого я получаю следующую ошибку:
Serverless: Excluding development dependencies...
Serverless Error ---------------------------------------
No file matches include / exclude patterns
Stack Trace --------------------------------------------
ServerlessError: No file matches include / exclude patterns
at globby.then.allFilePaths (/sls-1.35.1/node_modules/serverless/lib/plugins/package/lib/packageService.js:209:13)
at <anonymous>
From previous event:
at Package.resolveFilePathsAll (/sls-1.35.1/node_modules/serverless/lib/plugins/package/lib/packageService.js:147:48)
at Package.packageAll (/sls-1.35.1/node_modules/serverless/lib/plugins/package/lib/packageService.js:84:17)
at BbPromise.all.then (/sls-1.35.1/node_modules/serverless/lib/plugins/package/lib/packageService.js:75:21)
From previous event:
at Package.packageService (/sls-1.35.1/node_modules/serverless/lib/plugins/package/lib/packageService.js:73:43)
From previous event:
at Object.package:createDeploymentArtifacts [as hook] (/sls-1.35.1/node_modules/serverless/lib/plugins/package/package.js:64:10)
at BbPromise.reduce (/sls-1.35.1/node_modules/serverless/lib/classes/PluginManager.js:391:55)
From previous event:
at PluginManager.invoke (/sls-1.35.1/node_modules/serverless/lib/classes/PluginManager.js:391:22)
at PluginManager.run (/sls-1.35.1/node_modules/serverless/lib/classes/PluginManager.js:422:17)
at variables.populateService.then.then (/sls-1.35.1/node_modules/serverless/lib/Serverless.js:157:33)
at runCallback (timers.js:794:20)
at tryOnImmediate (timers.js:752:5)
at processImmediate [as _immediateCallback] (timers.js:729:5)
From previous event:
at Serverless.run (/sls-1.35.1/node_modules/serverless/lib/Serverless.js:144:8)
at serverless.init.then (/sls-1.35.1/node_modules/serverless/bin/serverless:44:28)
at <anonymous>
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information -----------------------------
OS: linux
Node Version: 8.10.0
Serverless Version: 1.35.1
2019/01/09 20:29:49 Error: exec: internal error
====================
? Cleanup
====================
2019/01/09 20:29:49 Post deploy cleanup