nestjs-sqs
nestjs-sqs copied to clipboard
Connection to SQS does not recover?
After an app loses connection with SQS, it's unable to recover it once the Internet connection is back.
I've noticed this when I left my app running on my laptop overnight (with wifi off) and opened it in the morning to find this:
Error 01/03/2021, 22:00:18 /Users/anton/projects/****/tail/node_modules/sqs-consumer/dist/consumer.js:45
const sqsError = new errors_1.SQSError(message);
^ - {"stack":[null]}
Error 01/03/2021, 22:00:18 SQSError: SQS receive message failed: Inaccessible host: `sqs.ap-southeast-2.amazonaws.com'. This service may not be available in the `ap-southeast-2' region.
at toSQSError (/Users/anton/projects/****/tail/node_modules/sqs-consumer/dist/consumer.js:45:22)
at Consumer.receiveMessage (/Users/anton/projects/****/tail/node_modules/sqs-consumer/dist/consumer.js:155:19)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:94:5) - {"stack":[null]}
This is fine but when the wifi is back on, and I push events to the queue, the app doesn't seem to be consuming anything.
Hi @thehappycoder , I have the same problem, did you find a solution to ensure that the connection is retablished ?
Same problem, any quick resolutions available?
Make sure you have an @SqsConsumerEventHandler("queue_name", "error") handler. The default EventEmitter behavior when there isn't an error listener is rather extreme -- the process exits:
If an EventEmitter does not have at least one listener registered for the 'error' event, and an 'error' event is emitted, the error is thrown, a stack trace is printed, and the Node.js process exits. Source: https://nodejs.org/api/events.html#error-events
The param name is confusing for this decorator, should be queueName.
please see issue #42 -- if the promise doesn't resolve it will deadlock until reboot. there needs to be a TTL that will force reset the loop