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

Durable provider scope wins over non durable. #10594

Closed
3 of 15 tasks
vizio360 opened this issue Nov 24, 2022 · 2 comments · Fixed by #10698
Closed
3 of 15 tasks

Durable provider scope wins over non durable. #10594

vizio360 opened this issue Nov 24, 2022 · 2 comments · Fixed by #10698
Labels
needs triage This issue has not been looked into

Comments

@vizio360
Copy link
Contributor

vizio360 commented Nov 24, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

When using durable providers, if a service has 2 dependencies, one durable and the other still REQUEST scope but NON durable, the service inherits the REQUEST DURABLE scope.

Minimum reproduction code

https://github.com/vizio360/nestJSDurableProvidersIssue

Steps to reproduce

See reproduction code

Expected behavior

If there is at least one dependency with just REQUEST scope (non durable) the service should be REQUEST scope non durable as well.

REQUEST Scope non durable should win over REQUEST scope durable.

and I would expect the overall priority for scopes to be (high to low):

REQUEST non durable
REQUEST durable
DEFAULT

Package

  • I don't know. Or some 3rd-party package
  • @nestjs/common
  • @nestjs/core
  • @nestjs/microservices
  • @nestjs/platform-express
  • @nestjs/platform-fastify
  • @nestjs/platform-socket.io
  • @nestjs/platform-ws
  • @nestjs/testing
  • @nestjs/websockets
  • Other (see below)

Other package

No response

NestJS version

9.2.0

Packages versions

[System Information]
OS Version     : macOS Monterey
NodeJS Version : v16.13.2
NPM Version    : 8.1.2 

[Nest CLI]
Nest CLI Version : 9.1.5 

[Nest Platform Information]
platform-express version : 9.2.0
schematics version       : 9.0.3
graphql version          : 10.1.6
testing version          : 9.2.0
apollo version           : 10.1.6
common version           : 9.2.0
core version             : 9.2.0
cli version              : 9.1.5

Node.js version

16.13.2

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@vizio360 vizio360 added the needs triage This issue has not been looked into label Nov 24, 2022
@vizio360
Copy link
Contributor Author

I've removed the TRANSIENT scope from the expected overall scope priority as it is a special case as explained in the docs: https://docs.nestjs.com/fundamentals/injection-scopes#scope-hierarchy

vizio360 added a commit to vizio360/nest that referenced this issue Dec 12, 2022
If an instance has at least one dependency that is Request scope non durable, then the instance should be Request scope non durable itself.

Closes nestjs#10594
vizio360 added a commit to vizio360/nest that referenced this issue Dec 12, 2022
If an instance has at least one dependency that is Request scope non durable, then the instance should be Request scope non durable itself.

Closes nestjs#10594
@kamilmysliwiec
Copy link
Member

Let's track this here #10698

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage This issue has not been looked into
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants