我试图使无服务器创建触发器以在对象排队时触发。但是它不会创建,也不会引发任何错误。

我的serverless.yml:
我根据文档(https://serverless.com/framework/docs/providers/aws/events/sqs/)做了



service: lambda-messages

provider:
  name: aws
  runtime: nodejs8.10
  stage: dev
  region: us-east-1
  memorySize: 256
  iamRoleStatements:
   - Effect: "Allow"
     Action:
     - sqs:SendMessage
     - sqs:ReceiveMessage
     - sqs:DeleteMessage
     - sqs:GetQueueAttributes
     Resource: arn:aws:sqs:us-east-1:074601456889:messages

functions:
  addMessages:
    timeout: 10
    handler: handler.addMessages
    events:
     - http:
         path: v1/chat/addMessages
         method: post

  receiveMessage:
    timeout: 10
    handler: handler.receiveMessage
    reservedConcurrency: 10
    events:
     - sqs:
       arn: arn:aws:sqs:us-east-1:074601456889:messages
       batchSize: 2





但它不会创造

Image console lambda

最佳答案

问题在于您的YAML文件中的缩进,只需在“ arn”和“ batchSize”前面添加两个空格

关于javascript - 无服务器不创建SQS事件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/51974560/

10-13 06:42