-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Cannot get two database connections working at the same time using ormconfig.json #2692
Comments
I'm having a similar error. Using multiple connections work fine until I want to use TypeOrm entity-features (so anything other than raw imports: [
TypeOrmModule.forFeature([MyEntity], 'connection2'),
], in the relevant module, Nest returns the error 'Nest can't resolve dependencies of the connection2Connection_MyEntityRepository (?)'. Changing the positon of the TypeOrmModule.forRootAsync({
imports: [ConfigModule],
useFactory: async (configService: ConfigService) => ({...})
});
TIA. Edit:Using the second connection works as intended when using |
Duplicate of nestjs/typeorm#66 |
Came up with this workaround to create two connections from ormconfig.json
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug Report
Current behaviour
I have the following ormconfig.json:
And the following configuration iside my modules.
On startupt I get the following error:
Nest can't resolve dependencies of the employees_AddressRepository (?).
Expected behavior
Nest should initialise without any issues and should be able to access the databases.
Update
I think it has something to do with the
name
property of the connection.I've tried to setup my connection via
forRootAsync
and I get the same error when I set the connection name in the async block. My code below.The text was updated successfully, but these errors were encountered: