You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whenever an error is thrown inside a batch message handler and there is no error event handler method, an uncaught exception is thrown and kills the app.
Steps to reproduce:
Set up handler like so:
@SqsMessageHandler('test', true)
public async handleMessage(messages: SQS.Message[]): Promise<void> {
throw new Error('test')
}
Do NOT include @SqsConsumerEventHandler('test', 'error').
It seems like when I include the error event handler, the error is able to be caught and logged. The app continues to run.
Expectation:
The error event handler should be an opt-in feature. The app should continue to function if individual handlers fail for whatever reason.
Results:
Throws uncaught exception
[1656014764276] ERROR: Error: Unexpected message handler failure: test
at RentlyWebhookSqsHandler.handleMessage (C:\SourceControl\GITHUB\everest\backend\src\rently\sqs-handlers\rently-webhook-sqs-handler.service.ts:27:11)
at Consumer.executeBatchHandler (C:\SourceControl\GITHUB\everest\backend\node_modules\@ssut\nestjs-sqs\node_modules\sqs-consumer\dist\consumer.js:303:24)
at Consumer.processMessageBatch (C:\SourceControl\GITHUB\everest\backend\node_modules\@ssut\nestjs-sqs\node_modules\sqs-consumer\dist\consumer.js:267:24)
at Consumer.handleSqsResponse (C:\SourceControl\GITHUB\everest\backend\node_modules\@ssut\nestjs-sqs\node_modules\sqs-consumer\dist\consumer.js:113:32)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Also terminates the app.
The text was updated successfully, but these errors were encountered:
I think the necessary fix would be to have a default error listener on all consumers if one is not provided OR the sqs-consumer package should be emitting processing_error instead of error on batch message handlers throw errors.
Whenever an error is thrown inside a batch message handler and there is no error event handler method, an uncaught exception is thrown and kills the app.
Steps to reproduce:
@SqsConsumerEventHandler('test', 'error')
.It seems like when I include the error event handler, the error is able to be caught and logged. The app continues to run.
Expectation:
The error event handler should be an opt-in feature. The app should continue to function if individual handlers fail for whatever reason.
Results:
Throws uncaught exception
Also terminates the app.
The text was updated successfully, but these errors were encountered: