#Logger not Injectable in forRootAsync ?

4 messages · Page 1 of 1 (latest)

half knoll
#

I'm trying to inject Nest's Logger into the graphQL module like so:

      driver: ApolloDriver,
      inject: [Logger],
      useFactory: (logger: Logger) => ({
        autoSchemaFile: join(process.cwd(), 'src/schema.gql'),
        sortSchema: true,
        context: ({ req, res }) => ({ req, res }),
        formatError: new ApolloErrorConverter({
          logger: logger,
        }),
      }),
    }),```
Error:  ERROR [ExceptionHandler] Nest can't resolve dependencies of the GqlModuleOptions (?). Please make sure that the argument Logger at index [0] is available in the GraphQLModule context.
#

Is this not the propper way to inject it ?

winged drum
#

you can do that but Logger from @nestjs/common isn't a provider

half knoll
#

How can I have Logger Injected then ?