Connection "default" was not found with TypeORM

connections synonym
make connections synonym
how to pronounce connection
connection quotes
connection sentence
connection furniture
connection company
connection song

I use TypeORM with NestJS and I am not able to save properly an entity.

The connection creation works, postgres is running on 5432 port. Credentials are OK too.

However when I need to save a resource with I got :

Connection "default" was not found.

    at new ConnectionNotFoundError (/.../ConnectionNotFoundError.ts:11:22)

I checked the source file of TypeORM ConnectionManager ( but it seems that the first time TypeORM creates connection it attributes "default" name if we don't provide one, which is the case for me.

I setup TypeORM with TypeOrmModule as

      type: config.db.type,
      port: config.db.port,
      username: config.db.user,
      password: config.db.password,
      database: config.db.database,
      entities: [
        __dirname + '/../../dtos/entities/*.entity.js',

Of course my constants are correct. Any ideas ?

You are trying to create a repository or manager without the connection being established.

Try doing this const shopkeeperRepository = getRepository(Shopkeeper); inside a function. it will work

7 Ways to Create Connection With Your Partner, happens when partners have time to be together in a fun and relaxed way -- like over dinner, taking a walk together, sharing interesting things about their day, cooking together, creating something together, holding each other and talking, playing a sport together, watching a funny show together, and so on. Connection definition is - the act of connecting : the state of being connected: such as. How to use connection in a sentence.

the upvoted answer is not necessarily correct, if you not specify the connection name it will default to "default".

const manager = getConnectionManager().get('your_orm_name');
const repository = manager.getRepository<AModel>(Model);

Connection dictionary definition, of conncection is the link between a mom and her kids. Connection is a leader in providing smart, cutting-edge technology solutions for global organizations of all sizes. Business. Enterprise Solutions.

Although Saras Arya has provided the correct answer, I have encountered the same error

ConnectionNotFoundError: Connection "default" was not found.

due to the fact that my typeORM entity did have an @Entity() decorator as well as that it had extended BaseEntity.

The two can't live together.

Business Technology Products, Services & Solutions, Listen to "Connection," out now: Shop OneRepublic: http Duration: 2:46 Posted: Aug 28, 2018 connection - a relation between things or events (as in the case of one causing the other or sharing features with it); "there was a connection between eating that pickle and having that nightmare" connectedness, connexion relation - an abstraction belonging to or characteristic of two entities or parts together

For those of you looking for another answer, check this out.

In my case, the issue was because I was passing name in my db config.

export const dbConfig = {
    name: 'myDB',

await createConnection(dbConfig) // like this

As a result, the only connection server knows is myDB not default.

At the same time, in my service, repository was injected without name which will fallback to default. (Service will looking for default connection as a result)

@Service() // typedi
export class Service {
        // inject without name -> fallback to default
        @InjectRepository() private readonly repository
    ) {}

As a fix, I removed name property in my db config.

Or you can pass myDB as a parameter for InjectRepository like @InjectRepository('myDB'), either way works.

Connection Synonyms, Connection Antonyms, the state of being connected: the connection between cause and effect. anything that connects; a connecting part; link; bond: an electrical connection. association;​  Connection definition, the act or state of connecting. See more.

OneRepublic - Connection, connection (countable and uncountable, plural connections). (uncountable) The act of The point at which two or more things are connected. quotations ▽. 57 synonyms of connection from the Merriam-Webster Thesaurus, plus 138 related words, definitions, and antonyms. Find another word for connection.

Connection, connection meaning: 1. the state of being related to someone or something else: 2. on the subject of something: 3…. Learn more. Synonyms for connection at with free online thesaurus, antonyms, and definitions. Find descriptive alternatives for connection.

connection, Connection may refer to: Contents. 1 Mathematics; 2 Music; 3 Other uses; 4 See also. Mathematics[edit]. Connection (algebraic framework) · Connection  Connection Credit Union is a member-owned credit union that serves the people who live, work, worship or go to school in Kitsap County.

  • I assume you must provide entities to the TypeORM configuration (e.g. entities: 'src/*/**.entity.ts').
  • Yes I have referenced my entities this way : entities: [ __dirname + '/../../dtos/entities/*.entity.js', ], I edit my post
  • Not if you're using active record pattern:…
  • Ut works fine when I launch it with ts-node and starts to fail after transpilation. What do you mean two can't live together? Can you elaborate?