'无服务器调用本地-功能'-'找不到模块.... \ .. webpack \ service'

时间:2018-07-05 10:06:43

标签: webpack serverless aws-serverless

尝试使用无服务器和AWS DynamoDB data(0)=2.1 data(1)=000123 data(2)=Garden Isle, Inc. data(3)=PKF data(4)=0.00 data(5)=Faster 测试api端点,但这在尝试与webpack捆绑在一起时返回以下错误:

Error in terminal

使用无服务器版本1.28.0。生成.webpack / service文件夹时,其中没有内容。我曾尝试在其他地方寻找类似的错误,包括在无服务器官方论坛上,但找不到类似的内容。

serverless.yml:

serverless invoke local --function create --path ../mocks/create-event.json

webpack.config.js:

service: notes-app-api

# Use the serverless-webpack plugin to transpile ES6
plugins:
  - serverless-webpack
  - serverless-offline

# serverless-webpack configuration
# Enable auto-packing of external modules
custom:
  webpack:
    webpackConfig: ./webpack.config.js
    includeModules: true

provider:
  name: aws
  runtime: nodejs8.10
  stage: prod
  region: eu-west-2

  # 'iamRoleStatements' defines the permission policy for the Lambda function.
  # In this case Lambda functions are granted with permissions to access 
DynamoDB.
  iamRoleStatements:
    - Effect: Allow
      Action:
        - dynamodb:DescribeTable
        - dynamodb:Query
        - dynamodb:Scan
        - dynamodb:GetItem
        - dynamodb:PutItem
        - dynamodb:UpdateItem
        - dynamodb:DeleteItem
      Resource: "arn:aws:dynamodb:eu-west-2:*:*"

functions:
  create:
    handler: '../create.main'
    events:
      - http:
          path: notes
          method: post
          cors: true
          authorizer: aws_iam

  get:
    handler: get.main
    events:
      - http:
        path: notes/id
        method: get
        cors: true
        authorizer: aws_iam

0 个答案:

没有答案