serverless-plugins icon indicating copy to clipboard operation
serverless-plugins copied to clipboard

sqs does not work in combination with normal http events

Open sambP opened this issue 3 years ago • 5 comments

I'm not able to get serverless-offline-sqs working in combination with "normal" HTTP lambdas. After adding the plugin in the serverless.yml, serverless offline does not start the HTTP server anymore. But the sqs triggered lambda is working great. Do I miss something here?

My versions:

    "serverless": "2.66.2",
    "serverless-offline": "8.2.0",
    "serverless-offline-sqs": "6.0.0",

serverless.yml

plugins:
  - serverless-webpack
  - serverless-offline-sqs
  - serverless-offline

custom:
  serverless-offline-sqs:
    autoCreate: false
    apiVersion: '2012-11-05'
    endpoint: http://0.0.0.0:9324
    region: ${self:provider.region}
    accessKeyId: root
    secretAccessKey: root
    skipCacheInvalidation: false

functions:
  httpsLambda:
    name: x
    handler: x
    events:
      - http:
          path: /x
          method: post

  sqsLambda:
    name: y
    handler: y
    events:
      - sqs:
          arn: arn:aws:sqs:${self:provider.region}:${self:custom.accountId}:${self:custom.queue}
          batchSize: 1

resources:
  Resources:
    queue:
      Type: AWS::SQS::Queue
      Properties:
        QueueName: ${self:custom.queue}
        VisibilityTimeout: 300 # 5min
        ContentBasedDeduplication: true

sambP avatar Nov 23 '21 21:11 sambP

With this plugin order, the http server is starting again, but the sqs lambda gets not triggered anymore.

plugins:
  - serverless-webpack
  - serverless-offline
  - serverless-offline-sqs

sambP avatar Nov 23 '21 21:11 sambP

I got the same issue when running serverless offline, but it worked with serverless offline start

peternycander avatar Dec 21 '21 17:12 peternycander

Thank you very much! This works also for me.

sambP avatar Dec 21 '21 19:12 sambP

Worked for me as well. Thank you :)

jrno avatar Jan 20 '22 14:01 jrno

adding start after serverless offline worked for me too!

gndelia avatar Aug 19 '22 19:08 gndelia