I have a FIFO queue with over 2 mil messages available. And I want to process them with lambda functions but 9 out of 10 times I poll messages I get a reply that the queue is empty. Which is definitely not true. I tried to change to long poll but it didn't helped. Here is my code for polling messages.
import { create as listenToSqsQueue } from "sqs-consumer";
listenToSqsQueue({
queueUrl: Config.aws.sqsurl,
handleMessage: async function (message, done){
// do some work with `message`s
Promise.resolve(invokePoller(functionName, message, callback));
done();
}
,
batchSize: 10
}).on("empty", function() {
callback(undefined, "Queue is empty");
}).on("error", function(error: Error, message: any) {
console.error(error, message);
callback(error)
}).start();