NestJS · Middle · Question 17 of 75
What is a side effect of making a provider request-scoped?
- ✓Correct answer: Everything that depends on it also becomes request-scoped, so many objects are created per request, which costs performance
- 2It only affects that provider
- 3It makes the provider global
Explanation
Scope bubbles up the injection chain. For per-request data like a request ID, AsyncLocalStorage (e.g. via nestjs-cls) is often a cheaper option.