Closed leandroluk closed 3 days ago
Thank you for taking the time to submit your report! From the looks of it, this could be better discussed on our Discord. If you haven't already, please join here and send a new post in the # 🐈 nestjs-help forum. Make sure to include a link to this issue, so you don't need to write it all again. We have a large community of helpful members, who will assist you in getting this to work.
Is there an existing issue for this?
Current behavior
I have an application with this structure with code:
src/resources/root/root.resource.ts
```ts import {ModuleRef} from '@nestjs/core'; import {Query, Resolver} from '@nestjs/graphql'; @Resolver() export class RootResolver { @Query(() => String, {description: 'Application is healthy'}) async healthcheck(): Promise
src/resources/root/root.module.ts
```ts import {Global, Module, Provider} from '@nestjs/common'; import {RootResolver} from './root.resolver'; const providers = Array
src/resources/resources.module.ts
```ts import {Global, Module} from '@nestjs/common'; import {RootModule} from './root/root.module'; const modules = [RootModule]; @Global() @Module({ imports: modules, exports: modules }) export class ResourcesModule {} ```
src/app.module.ts
```ts import {ApolloDriver, ApolloDriverConfig} from '@nestjs/apollo'; import {Global, Module, Provider} from '@nestjs/common'; import {GraphQLModule} from '@nestjs/graphql'; import {ResourcesModule} from './resources'; @Global() @Module({ imports: [ GraphQLModule.forRoot
Based on @nestjs/graphql, if I have nested a
Resource
all I have to do is add the nested module that contains the Resource but when I start the application I get the error "Error: Query root type must be provided."I even tried to directly import the RootModule in the GraphqlModule but the code is still showing the same error.
The only way to get rid of the error is to declare the RootProvider directly in the AppModule
Minimum reproduction code
maybe isn't necessary when all expected code is declarated belo
Steps to reproduce
Expected behavior
Expected to application starts normally
Package version
12.2.1
Graphql version
graphql
: 16.9.0@apollo/server
: 4.11.2NestJS version
10.0.0
Node.js version
20.17.0
In which operating systems have you tested?
Other
No response