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

Subscription graphql this on resolve does not access services being injected in the constructor #3205

Open
2 of 4 tasks
Ferm0494 opened this issue Apr 17, 2024 · 1 comment

Comments

@Ferm0494
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

When accessing the this on the resolve method helper within @Subscription in graphql it does not access the DI services being injected into the constructor of that resolver

Minimum reproduction code

#354

Steps to reproduce

  1. Create a resolver
  2. Inject some services within the constructor of that resolver
  3. Add a @Subscription decorator in any method of your created resolver.
  4. Add the resolve method in the @Subscription decorator and in the first argument put the this with type instance of your resolver class.
  5. Try to use any method of your services being injected.
  6. You can't use any because none of your services got injected into the this instance reference.

Expected behavior

You should be able to use the methods of your injected services in the this reference in the resolve method in @Subscription

Package version

12.1.1

Graphql version

graphql: 16.8.1
apollo-server-express: 3.13.0
apollo-server-fastify:

NestJS version

10.3.0

Node.js version

18.17.1

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

@kamilmysliwiec
Copy link
Member

Please provide a minimum reproduction repository (Git repository/StackBlitz/CodeSandbox project).

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

No branches or pull requests

2 participants