lehh / nestjs-soap

Nestjs module wrapper for soap npm package
MIT License
21 stars 15 forks source link

Getting error while injecting ConfigService in SoapModule #13

Closed dhirajkumar94 closed 3 years ago

dhirajkumar94 commented 3 years ago

I've created the following module:


import { Module } from '@nestjs/common';
import { OmnifinController } from './omnifin.controller';
import { OmnifinService } from './omnifin.service';
import { SoapModule, SoapModuleOptions } from 'nestjs-soap';
import { ConfigModule, ConfigService } from '@nestjs/config';

@Module({
  imports: [
    ConfigModule,
    SoapModule.forRootAsync([
      {
        name: "OMNIFIN_CLIENT",
        imports: [ConfigModule],
        inject: [ConfigService],
        useFactory: async (configService: ConfigService): Promise => (
          {
            uri: configService.get('omnifin.url'),
          }
        )
      }
    ])
  ],
  controllers: [OmnifinController],
  providers: [OmnifinService]
})
export class OmnifinModule {}

which is working properly with SoapModule.registerAsync, but giving the following error with forRootAsync:


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

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

Environment


NestJS version: 8.1.1
NestJS Dynamoose version: 0.3.3
Dynamoose version: 2.8.2

For Tooling issues:
- Node version: 14.15.3
- Platform:  Mac, Linux
lehh commented 3 years ago

Hello @dhirajkumar94.

Thanks for reporting. Just fixed it and I'm gonna publish it soon.

Published on v1.2.4.