Skip to content

fix(nestjs): Handle multiple OnEvent decorators #16306

New issue

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

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

Already on GitHub? # to your account

Merged
merged 5 commits into from
May 19, 2025

Conversation

chargome
Copy link
Member

@chargome chargome commented May 15, 2025

Problem is that within the execution there is no way of detecting the triggering event.

  • Because of this we now emit a merged transaction name of all applied events – but will add a note on docs that we recommend just putting one decorator per function. We do this by reading the metadata applied on the function by nestjs.
  • Adds a flag to avoid double wrapping of the descriptor value (this way we get the correct payload per event and make sure the handler is executed for each event)

closes #15218

@chargome chargome self-assigned this May 15, 2025
@chargome chargome marked this pull request as ready for review May 15, 2025 14:28
@chargome chargome requested review from mydea and andreiborza May 15, 2025 14:35
@chargome chargome merged commit d575638 into develop May 19, 2025
308 of 310 checks passed
@chargome chargome deleted the cg-nest-fix-decorators branch May 19, 2025 13:19
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nest-js instrumentation breaks @nestjs/event-emitter when using multiple @OnEvent on the same method
2 participants