CoorpAcademy / serverless-plugins

Collection of serverless plugins :zap:
231 stars 132 forks source link

fifo not working for me #159

Open sambP opened 3 years ago

sambP commented 3 years ago

I have currently this serverless config:

plugins:
  - serverless-webpack
  - serverless-s3-local
  - serverless-offline-sqs
  - serverless-offline
  - serverless-plugin-scripts

custom:
  region: ${self:provider.region}
  stage: ${opt:stage, 'development'}
  prefix: ${self:custom.stage}-${self:service}
  processQueue: ${self:custom.prefix}-process-queue.fifo
  processService: ${self:custom.prefix}-process-service
  serverless-offline-sqs: #only for local development
    autoCreate: true
    apiVersion: '2012-11-05'
    endpoint: http://0.0.0.0:9324
    region: ${self:custom.region}
    accessKeyId: root
    secretAccessKey: root
    skipCacheInvalidation: false

functions:
  processService:
    name: ${self:custom.processService}
    handler: be/processService/processService.handler
    timeout: 3600 #1h
    events:
      - sqs:
          arn: arn:aws:sqs:${self:custom.region}:XXXXXX:${self:custom.processQueue}
          batchSize: 1

resources:
  Resources:
    processQueue:
      Type: AWS::SQS::Queue
      Properties:
        QueueName: ${self:custom.processQueue}
        FifoQueue: true
        VisibilityTimeout: 3605 # 1h

When trying to push a messge like this, I get an error.

{
    QueueUrl: config.processSQSUrl,
    MessageBody: JSON.stringify(process),
    MessageGroupId: user._id.toString(),
    MessageDeduplicationId: process._id.toString(),
  }

Error: Value 5fd60febddc333276ed29e1e for parameter MessageGroupId is invalid. The request include parameter that is not valid for this queue type

A message like this works fine.

{
    QueueUrl: config.processSQSUrl,
    MessageBody: JSON.stringify(process),
  }

So I expect, that the queue, which is being created, is not a fifo queue. Did I miss something here? Thanks for your time!

jodaltrof3 commented 5 months ago

Same here, did you find a sulution?