doug-martin / nestjs-query

Easy CRUD for GraphQL.

Home Page:https://doug-martin.github.io/nestjs-query

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incompatibility with @nestjs/graphql ^9.1.0

simnado opened this issue · comments

Using nestjs-query with @nestjs/graphql in Version 9.1.0 or higher leads to Errors in the console for each auto-generated Resolver. The errors look like the following output:

ERROR [ResolversExplorerService] "<xy>DTOAutoResolver" resolver is request or transient-scoped. Resolvers that register subscriptions with the "@Subscription()" decorator must be static (singleton).

Packages I used:

    "@nestjs-query/core": "^0.30.0",
    "@nestjs-query/query-graphql": "^0.30.0",
    "@nestjs-query/query-mongoose": "^0.30.0",
    "@nestjs/common": "^8.2.4",
    "@nestjs/core": "^8.2.4",
    "@nestjs/graphql": "^9.1.2",
    "@nestjs/platform-express": "^8.2.4",

I have the same problem, anybody else facing this issue?

So we found the solution to this problem here.
As nestjs clearly states, the scope of the service bubbles up in the injection graph.

We had a logger service which was not explicitely marked as Scope.Request but we injected the REQUEST object which turned it into a request-scoped service. This in turn turned all related services/modules into request-scoped which wasn't apparent in older nestjs versions but due to the new error message was clear now.

Injecting the request context in a different way, i.e. https://www.npmjs.com/package/nestjs-request-context, solved the problem for us. This issue can be closed @simnado

"@nestjs-query/query-graphql": "^0.30.0",
Current version is not compatible with

"@nestjs/graphql": "^10.0.6",
"@nestjs/apollo": "^10.0.6",

I'm using npm v8

and getting error trying to install this library

R! Found: @nestjs/graphql@10.0.6
npm ERR! node_modules/@nestjs/graphql
npm ERR!   @nestjs/graphql@"^10.0.6" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @nestjs/graphql@"^9.0.0" from @nestjs-query/query-graphql@0.30.0
npm ERR! node_modules/@nestjs-query/query-graphql
npm ERR!   @nestjs-query/query-graphql@"*" from the root project

 Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

I think it require @nesjs/graphql@9.0.0

for now, I just installed with --force tag like below
npm install @nestjs-query/query-graphql --force

but I think it is not strict