Multiple connections is not working
gperdomor opened this issue · comments
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
Can't use multiple database connections, I got this error:
Nest can't resolve dependencies of the otherDb_Entity3Repository (?). Please make sure that the argument otherDbConnection at index [0] is available in the TypeOrmModule context.
Potential solutions:
- If otherDbConnection is a provider, is it part of the current TypeOrmModule?
- If otherDb Connection is exported from a separate @Module, is that module imported within TypeOrmModule?
@Module({
imports: [ /* the Module containing geofenceConnection */ ]
})
+16ms
Error: Nest can't resolve dependencies of the otherDb_entity3Repository (?). Please make sure that the argument otherDbConnection at index [0] is available in the TypeOrmModule context.
Expected behavior
It should work according to the documentation
Minimal reproduction of the problem with instructions
Create a module
@Module({
imports: [
TypeOrmModule.forFeature([Entity1, Entity2]),
TypeOrmModule.forFeature([Entity3], 'otherDb')
],
controllers: [SomeController],
providers: [SomeService]
})
export class SomeModule {}
What is the motivation / use case for changing the behavior?
Environment
[System Information]
OS Version : macOS Catalina
NodeJS Version : v13.11.0
NPM Version : 6.14.4
[Nest CLI]
Nest CLI Version : 7.1.1
[Nest Platform Information]
platform-express version : 7.0.6
microservices version : 7.0.6
passport version : 7.0.0
swagger version : 4.5.1
typeorm version : 7.0.0
common version : 7.0.6
config version : 0.4.0
core version : 7.0.6
Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.
The problem I found was configuration. Someone has very helpfully updated the docs in a PR. nestjs/docs.nestjs.com#1994