BeerMoneyDev/nest-aws-sdk

CredentialsError: Missing credentials in config

whizyrel opened this issue · 1 comments

I can not seem to get this fixed. Below is the error I get even when the config is loaded in the module initialization.
UnhandledPromiseRejectionWarning: CredentialsError: Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1

This is an impl snippet:

@Module({
  imports: [
    AwsSdkModule.forRootAsync({
      services: [SecretsManager, STS],
      defaultServiceOptions: {
        useFactory: (config: ConfigService) => {
          const awsConfig = config.get<IAWSConfig>('aws');

          return {
            region: awsConfig.general.region,
            credentials: new Credentials(
              awsConfig.keys.accessKeyId,
              awsConfig.keys.secretAccessKey,
            ),
          };
        },
        imports: [ConfigModule],
        inject: [ConfigService],
      },
    }),
    ConfigModule.forRoot({
      isGlobal: true,
      load: [...],
    }),
  ],
});

Alas, Somebody help!

@KerryRitter @benMain

Btw, none of the other options worked (same error) including statically providing the config. Also, the project runs in a docker container

Hi @whizyrel, I haven't really encountered this error so I don't have any recommendations. If you can post a repo I can take a look.