使用seed.run部署aws lamda生成没有文件匹配包含/排除模式

时间:2019-01-09 21:13:46

标签: node.js aws-lambda serverless-framework aws-serverless

我已经按照Object#in?教程进行了学习,并将代码拆分为多个服务。 现在,当我使用seed.run部署它时,我只能部署数据库服务(表格)。部署的第一阶段。进入lambda服务时,出现“没有文件匹配包含/排除模式”错误

我尝试添加具有不同路径类型的服务,例如/ services / service /,services / service等。我还尝试仅部署一些具有相同结果的lambda函数。

服务: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

我希望可以部署lambda服务,但是却收到以下错误消息:

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

0 个答案:

没有答案