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
Multiple databases with Sequelize #183
Comments
Please provide a minimum reproduction repository. |
Hello @kamilmysliwiec I thought I had put the essentials. Whick parts of code do you need more ? I was a project with one connection worked well. I tried to put a new postgres connection whom I named heroku. The first one does not have name (default). I create a new module Accounts, with module, service and model files (module and service file are shown above). I specify "heroku" connection for my account model :
And I finally obtain "Nest can't resolve dependencies of the AccountsService (?, heroku_AccountRepository). Please make sure that the argument herokuConnection at index [0] is available in the AccountsModule context." If I do not put "heroku" connection parameter, my app is compiling. |
After a lot of tries and checking TypeORM issues, I find a solution to my issue. The name of the connection must be outside the useFactory, like this :
|
Hi,
I'm trying to add a new database connection on my Nest project, but I do not success to do it even following the documentation (https://docs.nestjs.com/techniques/database#multiple-databases-1)
All was working well with my first database connection.
The error I obtain is "Nest can't resolve dependencies of the AccountsService (?, heroku_AccountRepository). Please make sure that the argument herokuConnection at index [0] is available in the AccountsModule context."
Here is my connections :
Here is my module :
Here is my service :
I saw that maybe I need to inject the connection on the service but I do not success to do it. Specially I do not understand what is the Sequelize type in the example.
Does exist some github repo with sequelize multiple datatase example ?
Thank you by advance for your help,
Ben.
The text was updated successfully, but these errors were encountered: