TypeOrmModule.forRootAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: (configService: ConfigService) => {
return {
type: 'mysql',
host: configService.get('TYPEORM_HOST'),
port: configService.get('TYPEORM_PORT'),
username: configService.get('TYPEORM_USERNAME'),
database: configService.get('TYPEORM_DATABASE'),
password: configService.get('TYPEORM_PASSWORD'),
entities: [__dirname + '/../entities/*.entity{.ts,.js}'],
synchronize: configService.get('TYPEORM_SYNCHRONIZE'),
logging: configService.get('TYPEORM_LOGGING'),
};
},
}),
I’m trying to connect to my aws rds instance but it gives an error something like this.
Error: Access denied for user 'xyz'@'1-2-3-4.ftth.glasoperator.nl' (using password: YES)
as you can see this is not my aws host. when I change TYPEORM_HOST to localhost it tries to connect 127.0.0.1 so reading from the env is working just fine.
I can connect to the aws rds with the same credentials from mysql workbench