question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HasuraModule with forRootAsync is not working

See original GitHub issue

When I import the HasuraModule with forRoot it works

     HasuraModule.forRoot(HasuraModule, {
         secretFactory: 'myadminsecretkey',
        secretHeader: 'x-hasura-admin-secret',
    }),

But when I import the module with forRootAsync it doesn’t work

    HasuraModule.forRootAsync(HasuraModule, {
      inject: [ConfigService],
      imports: [ConfigModule],
      useFactory: async (configService: ConfigService) => ({
        secretFactory: configService.get<string>('GRAPHQL_API_AUTH_TOKEN'),
        secretHeader: configService.get<string>('GRAPHQL_API_AUTH_HEADER'),
      }),
    }),

I think it’s something that I’m missing because no errors appears on the console just the RouteExplorer doesn’t map the routes.

Thanks for your support.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
WonderPandacommented, May 18, 2020

@rigobcastro If you’re still interested in testing the new config service checkout https://github.com/golevelup/ts-ecosystem/tree/master/libs/profiguration

It provides a number of benefits over the NestJS Configuration module that’ll help you achieve 12factor:

  • intellisense/type safety out of the box (you don’t need to do get<string>(key) because we already know it’s a string)
  • exists outside the DI system so you can use it anywhere (even in decorators!)
  • automatically coerces values to the correct datatype (no more needing to do weird conversions for boolean strings)
1reaction
WonderPandacommented, May 13, 2020

Hey @rigobcastro thanks for reporting this. It should be fixed as of @golevelup/nestjs-hasura@0.3.3

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeORM configuration works but not with ConfigService
One of two things needs to happen: 1) You need to make your ConfigModule global by passing the isGlobal: true option to ConfigModule....
Read more >
joe-forked-golevelup-nestjs-hasura - npm package - Snyk
No known security issues ... The Hasura Module supports both the forRoot and forRootAsync patterns for configuration, so you can easily ...
Read more >
@golevelup/nestjs-hasura - npm
Start using @golevelup/nestjs-hasura in your project by running `npm i ... The Hasura Module supports both the forRoot and forRootAsync ...
Read more >
NestJS integrations for Working with Hasura - Morioh
The Hasura Module supports both the forRoot and forRootAsync patterns for configuration, so you can easily retrieve the necessary config values from a ......
Read more >
MongoDB | NestJS - A progressive Node.js framework
With this, you can indicate whether a property is required or not, specify a ... Calling pre() or post() after compiling a model...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found