Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When command dispatched by event handler fails, application dies #219

Closed
johanbook opened this issue Jul 26, 2023 · 2 comments
Closed

When command dispatched by event handler fails, application dies #219

johanbook opened this issue Jul 26, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@johanbook
Copy link
Owner

johanbook commented Jul 26, 2023

When a command handler is dispatched from an event handler, and there is an unexpected exception on the command handler, the application will print the error

api            |
api            | /app/src/features/profiles/application/handlers/command-handlers/create-profile.handler.ts:33
api            |     throw new Error("this was an error");
api            |           ^
api            | Error: this was an error
api            |     at CreateProfileHandler.execute (/app/src/features/profiles/application/handlers/command-handlers/create-profile.handler.ts:33:11)
api            |     at processTicksAndRejections (node:internal/process/task_queues:95:5)

and stop.

This should be fixed, but it should also be detected via the infrastructure that pings the application via the health endpoints and the application should then be restarted.

@johanbook johanbook added the bug Something isn't working label Jul 26, 2023
@johanbook
Copy link
Owner Author

johanbook commented Jul 26, 2023

Similar issue as in nestjs/cqrs#1428. See also nestjs/cqrs#409. I have implemented subscriber for unexpected errors

I have bumped Nestjs to v10 and Nodejs to v20

@johanbook
Copy link
Owner Author

Opened nestjs/cqrs#1485

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant