Comments (3)
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 :
SequelizeModule.forRootAsync({
imports: [ConfigModule],
// HERE
name: 'heroku',
useFactory: (configService: ConfigService) => ({
// NOT HERE
// name: 'heroku',
dialect: 'postgres',
host: configService.get<string>('heroku.host'),
port: configService.get<number>('heroku.port'),
username: configService.get<string>('heroku.user'),
password: configService.get<string>('heroku.password'),
database: configService.get<string>('heroku.database'),
schema: configService.get<string>('heroku.schema'),
autoLoadModels: true,
synchronize: false,
}),
inject: [ConfigService],
})
from sequelize.
Please provide a minimum reproduction repository.
from sequelize.
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 :
SequelizeModule.forFeature([Account], 'heroku')
@InjectModel(Account, 'heroku')
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.
from sequelize.
Related Issues (20)
- Typescript 5 @InjectModel raises: Argument of type 'undefined' is not assignable to parameter of type 'string | symbol'.ts HOT 1
- Need to rebuild & republish to npm to get type from nestjs/common. Typescript 5 @InjectModel raises: Argument of type 'undefined' is not assignable to parameter of type 'string | symbol'.ts HOT 1
- sequelize 7 support HOT 1
- Durable - Multi Tenant setup with Sequelize does not work HOT 2
- Switch to sequelize v7 HOT 1
- Unresolved npm dependencies with nestjs 10.3.2 HOT 4
- Connect to Azure SQL using Azure AD Authentication per user HOT 1
- Action Required: Fix Renovate Configuration
- Sequelize version HOT 1
- Mssql SequelizeHostNotFoundError: Failed to connect to HOT 1
- Bag connection to MSSQL HOT 1
- Dependency Dashboard
- Do not synchronize by default?
- Connecting to Sequelize with a URL HOT 1
- If Sequelize is a provider, is it part of the current SequelizeModule? HOT 1
- How to access sequelize connection HOT 1
- Get connection object with multiple databases HOT 1
- @gperdomor there are a few minor breaking changes. You can find the migration guide & instructions on the `8.0.0` branch of the docs https://github.com/nestjs/docs.nestjs.com/tree/8.0.0 HOT 1
- Passing SQL connection string when registering module.
- Multi Tennant setup with Pooled Connections not working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sequelize.