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

ReadCountOutOfRange; see the SQS docs w/ sqs.batchSize > 1

Open bitsofinfo opened this issue 4 years ago • 5 comments

Running serverless 2.19.0 offline w/ "serverless-offline-sqs": "4.1.1",

      - sqs: 
          arn: <myqueuearn>
          batchSize: 50
          maximumBatchingWindow: 30
Serverless: [AWS sqs 400 0.152s 0 retries] receiveMessage({
  QueueUrl: 'http://localhost:9324/queue/my-queue',
  MaxNumberOfMessages: 50,
  AttributeNames: [ 'All', [length]: 1 ],
  MessageAttributeNames: [ 'All', [length]: 1 ],
  WaitTimeSeconds: 5
})
 
  Read Count Out Of Range --------------------------------
 
  ReadCountOutOfRange: ReadCountOutOfRange; see the SQS docs.

bitsofinfo avatar Jan 19 '21 01:01 bitsofinfo

if set to batchSize: 1 it works

bitsofinfo avatar Jan 19 '21 01:01 bitsofinfo

It appears I've hit this as well. Setting batchSize to 100 for instance causes the ReadCountOutOfRange error but 10 or below it's fine. I would expect this for an SQS source trigger on a FIFO queue but not a standard queue. Is this perhaps a side effect of the underlying use of ElasticMQ?

ghost avatar Jun 10 '21 15:06 ghost

Took me a while to find this one ... If anyone else comes across this problem of ReadCountOutOfRange when using a batch size higher than 10, this is the default "strict" setting on ElasticMQ's sqs-limits. The default limit is 10, see here StrictSQSLimits & RelaxedSQSLimits

By setting sqs-limit : relaxed in your elasticmq.conf you should be able to set the batchSize to 100 or more. This can be seen in the example config as well. Hope this helps!

kamauwashington avatar Aug 17 '21 01:08 kamauwashington

Adding the following to elasticmq.conf did not work for me:

rest-sqs {
  sqs-limit = relaxed
}

I'm using "serverless-offline-sqs": "^6.0.0"

bezreyhan avatar Mar 21 '23 23:03 bezreyhan

@bezreyhan might be late to the party but it's sqs-limits and not sqs-limit no idea if the property changed name or just a typo but hope it helps anyone else reading this issue

rest-sqs {
  sqs-limits = relaxed
}

AddeNordh avatar Apr 24 '23 14:04 AddeNordh