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

Using AzureStorageModule in different modules overrides one another's config #325

Closed
andre1ka-ber opened this issue Nov 28, 2023 · 1 comment

Comments

@andre1ka-ber
Copy link

andre1ka-ber commented Nov 28, 2023

I'm submitting a...


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

I am using AzureStorageModule.withConfigAsync() in different modules with different config, which includes SAS, storage account and default container name and then injecting AzureStorageService in providers section. So all services (in my case 2) contains same config. And a small note, second module using config of first module in list order in app.module.ts, if I change that order, config will be changed as well

imagine two module's options as below, the only difference is config in useFactory field

@Module({
    imports: [
      AzureStorageModule.withConfigAsync({
          useFactory: firstAzureConfig, // <-- in second module another config
          inject: [ConfigService],
      }),
    ], 
    providers: [
      {
          provide: AzureImagesStorageClient,
          useFactory: (azureService: AzureStorageService) => {
            console.log(azureService); // <-- here I see same configuration
            return new AzureImagesStorageClient(azureService);
          },
          inject: [AzureStorageService],
        }
    ]

image

Expected behavior

I expect that each module should contain its configuration and one should not override another one

Environment


Nest version: 10.2.10

 
For Tooling issues:
- Node version: v18.13.0
- Platform:  Linux
@kamilmysliwiec
Copy link
Member

Let's track this here nestjs/nest#13336

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