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

TemporalModule.registerClientAsync ignores imports passed to the dynamic module #53

Open
koppa96 opened this issue Oct 27, 2023 · 1 comment

Comments

@koppa96
Copy link

koppa96 commented Oct 27, 2023

I have the following code, which is quite similar to the example code provided for manually creating a connection.

TemporalModule.registerClientAsync({
  imports: [ConfigModule],
  inject: [ConfigService],
  useFactory: async (config: ConfigService) => {
    const temporalHost = config.get('TEMPORAL_URL', 'localhost:7233')
    const connection = await Connection.connect({
      address: temporalHost
    })

    return {
      connection
    }
  }
})

However I can't seem to make it work, because I get the following error:

Error: Nest can't resolve dependencies of the TemporalAsyncQueue_default (?). Please make sure that the argument ConfigService at index [0] is available in the TemporalModule context.

Potential solutions:
- If ConfigService is a provider, is it part of the current TemporalModule?
- If ConfigService is exported from a separate @Module, is that module imported within TemporalModule?
  @Module({
    imports: [ /* the Module containing ConfigService */ ]
  })

    at Injector.lookupComponentInParentModules (C:\Users\koppa.peter\Desktop\mti-hirugynokseg\src\sites\node_modules\.pnpm\@[email protected]_@[email protected]_@[email protected][email protected][email protected]\node_modules\@nestjs\core\injector\injector.js:241:19)
    at Injector.resolveComponentInstance (C:\Users\koppa.peter\Desktop\mti-hirugynokseg\src\sites\node_modules\.pnpm\@[email protected]_@[email protected]_@[email protected][email protected][email protected]\node_modules\@nestjs\core\injector\injector.js:194:33)
    at resolveParam (C:\Users\koppa.peter\Desktop\mti-hirugynokseg\src\sites\node_modules\.pnpm\@[email protected]_@[email protected]_@[email protected][email protected][email protected]\node_modules\@nestjs\core\injector\injector.js:116:38)
    at async Promise.all (index 0)
    at Injector.resolveConstructorParams (C:\Users\koppa.peter\Desktop\mti-hirugynokseg\src\sites\node_modules\.pnpm\@[email protected]_@[email protected]_@[email protected][email protected][email protected]\node_modules\@nestjs\core\injector\injector.js:131:27)
    at Injector.loadInstance (C:\Users\koppa.peter\Desktop\mti-hirugynokseg\src\sites\node_modules\.pnpm\@[email protected]_@[email protected]_@[email protected][email protected][email protected]\node_modules\@nestjs\core\injector\injector.js:57:13)
    at Injector.loadProvider (C:\Users\koppa.peter\Desktop\mti-hirugynokseg\src\sites\node_modules\.pnpm\@[email protected]_@[email protected]_@[email protected][email protected][email protected]\node_modules\@nestjs\core\injector\injector.js:84:9)
    at async Promise.all (index 3)
    at InstanceLoader.createInstancesOfProviders (C:\Users\koppa.peter\Desktop\mti-hirugynokseg\src\sites\node_modules\.pnpm\@[email protected]_@[email protected]_@[email protected][email protected][email protected]\node_modules\@nestjs\core\injector\instance-loader.js:44:9)
    at C:\Users\koppa.peter\Desktop\mti-hirugynokseg\src\sites\node_modules\.pnpm\@[email protected]_@[email protected]_@[email protected][email protected][email protected]\node_modules\@nestjs\core\injector\instance-loader.js:29:13

I tried to look into the source code and TemporalModule.registerClientAsync and the functions that invokes doesn't seem to do anything with the imports of the provided object.

@koppa96 koppa96 changed the title TemporalModule.registerClientAsync ignores providers passed to the dynamic module TemporalModule.registerClientAsync ignores imports passed to the dynamic module Oct 27, 2023
@mawaldne
Copy link

Also having this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants