Skip to content

fix(microservices): support custom strategy in async usefactory config #15172

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

Merged

Conversation

mag123c
Copy link
Contributor

@mag123c mag123c commented May 21, 2025

PR Checklist

PR Type

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

When using dynamic microservice configuration with useFactory, any strategy field returned from the factory function is ignored.
This makes it impossible to provide a custom transport strategy dynamically.

Issue Number: #15144

What is the new behavior?

NestMicroservice now properly checks for a strategy field after resolving AsyncMicroserviceOptions.useFactory().
Adds test cases to ensure both static and dynamic strategy injection paths work as expected.

Does this PR introduce a breaking change?

  • Yes
  • No

@coveralls
Copy link

Pull Request Test Coverage Report for Build cce34446-2ec7-40ad-b756-d2995a48a213

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 88.94%

Totals Coverage Status
Change from base Build 16a83cd7-0397-4555-852d-e8667ea8a43e: 0.0%
Covered Lines: 7197
Relevant Lines: 8092

💛 - Coveralls

@kamilmysliwiec kamilmysliwiec merged commit 0abbdbc into nestjs:master May 21, 2025
5 checks passed
@kamilmysliwiec
Copy link
Member

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants