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

"RegisterAsync" Does Not Work #4

Open
rosulg opened this issue Oct 18, 2019 · 2 comments
Open

"RegisterAsync" Does Not Work #4

rosulg opened this issue Oct 18, 2019 · 2 comments
Labels
bug

Comments

@rosulg
Copy link

@rosulg rosulg commented Oct 18, 2019

Hi!

When trying to inject my config service into NestPgpromiseModule the following error occurs:

[Nest] 75793   - 10/18/2019, 4:00:08 PM   [ExceptionHandler] Nest can't resolve dependencies of the NEST_PGPROMISE_OPTIONS (?). Please make sure that the argument ConfigService at index [0] is available in the NestPgpromiseModule context.

Potential solutions:
- If ConfigService is a provider, is it part of the current NestPgpromiseModule?
- If ConfigService is exported from a separate @Module, is that module imported within NestPgpromiseModule?
  @Module({
    imports: [ /* the Module containing ConfigService */ ]
  })
 +13ms
@Module({
  imports: [
    NestPgpromiseModule.registerAsync({
      imports: [ConfigModule],
      useFactory: (configService: ConfigService) => ({connection: configService.config}),
      inject: [ConfigService],
    }),
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule {}

I am following the example with TypeORM available here.

Also when looking at Your source code I can not determine what am I doing wrong.
Can You please provide me with an example how to correctly inject a service into Your module?

I have also provided a repository where this error occurs:
https://github.com/rosulg/example-nest-pg-promise

Best wishes,
Robin Sulg

@issue-label-bot issue-label-bot bot added the bug label Oct 18, 2019
@issue-label-bot

This comment has been minimized.

Copy link

@issue-label-bot issue-label-bot bot commented Oct 18, 2019

Issue-Label Bot is automatically applying the label bug to this issue, with a confidence of 0.70. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@rubiin

This comment has been minimized.

Copy link
Owner

@rubiin rubiin commented Nov 4, 2019

Will be fixing this as soon as I get some free time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.