title: Unale to connect to the postgres from TypeORM
body: <p>I'm using nestJS to connect to the database with TypeORM as the db package.
  My postgres is running in docker with ip 172.17.0.3: 5432</p>
  <blockquote>
  <p>sudo docker run --name postgre -e POSTGRES_USER=admin -e
  POSTGRES_PASSWORD=password -p 5432:5432 -v
  /data/postgres:/var/lib/postgresql/data -d postgres</p>
  </blockquote>
  <p>Here is my storage module file:</p>
  <pre><code>import { Module } from '@nestjs/common';
  import { storageConfig, StorageService } from './storage.service';
  import { TypeOrmModule} from '@nestjs/typeorm'
  import { User } from './entities/user.entity';
  
  @Module({
    providers: [StorageService],
    imports: [
      TypeOrmModule.forRoot({
        driver: 'pg',
        type: 'postgres',
        host: '172.17.0.3',
        port: 5432,
      
        username: 'admin',
        password: 'password',
        database: 'user_storage',
        schema: 'public',    
        entities: [User]    
      })
    ]
  })
  export class StorageModule {}
  </code></pre>
  <p>Now with this I tried importing the users.module.ts</p>
  <pre><code>import { Module } from '@nestjs/common';
  import { UsersService } from './users.service';
  import { UsersController } from './users.controller';
  import { TypeOrmModule } from '@nestjs/typeorm'
  
  @Module({
    imports: [TypeOrmModule.forRoot()],
    controllers: [UsersController],
    providers: [UsersService]
  })
  export class UsersModule {}
  </code></pre>
  <p>and I use repository in  a service:</p>
  <pre><code>import { Injectable } from '@nestjs/common';
  import { UserRequest, UserResponse } from './user.models';
  import {DataSource, Repository } from 'typeorm'
  import { User } from 'src/storage/entities/user.entity';
  
  
  
  @Injectable()
  export class UsersService {
    private readonly _users: Repository&lt;User&gt; 
  
    constructor(private ds: DataSource) { 
      this._users = this.ds.getRepository(User)
    }
  
    async create(req: UserRequest) {
      const user = this._users.create()
  
      user.id = 1
      user.name = req.name
      user.age = req.age
      user.address = req.address
      user.notes = ''
  
      const saveduser = await this._users.save(user)
  
      return saveduser.id;
    }
  }
  </code></pre>
  <p>But I keep getting this error whenever I run:</p>
  <pre><code>[Nest] 36982  - 07/05/2022, 12:02:19 PM     LOG [NestFactory] Starting Nest application... 
  [Nest] 36982  - 07/05/2022, 12:02:20 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)... MissingDriverError: Wrong driver: &quot;undefined&quot; given. Supported drivers are: &quot;aurora-mysql&quot;, &quot;aurora-postgres&quot;, &quot;better-sqlite3&quot;, &quot;capacitor&quot;, &quot;cockroachdb&quot;, &quot;cordova&quot;, &quot;expo&quot;, &quot;mariadb&quot;, &quot;mongodb&quot;, &quot;mssql&quot;, &quot;mysql&quot;, &quot;nativescript&quot;, &quot;oracle&quot;, &quot;postgres&quot;, &quot;react-native&quot;, &quot;sap&quot;, &quot;sqlite&quot;, &quot;sqljs&quot;, &quot;spanner&quot;.
      at DriverFactory.create (/projects/hw/src/driver/DriverFactory.ts:72:23)
      at new DataSource (/projects/hw/src/data-source/DataSource.ts:139:43)
      at createTypeormDataSource (/projects/hw/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:172:23)
      at Function.&lt;anonymous&gt; (/projects/hw/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:176:46)
      at Generator.next (&lt;anonymous&gt;)
      at /projects/hw/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:20:71
      at new Promise (&lt;anonymous&gt;)
      at __awaiter (/projects/hw/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:16:12)
      at /projects/hw/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:174:76
      at Observable._subscribe (/projects/hw/node_modules/rxjs/src/internal/observable/defer.ts:55:15) [Nest] 36982  - 07/05/2022, 12:02:20 PM   ERROR [TypeOrmModule] Unable to connect to the database. Retrying (1)... TypeError: this.postgres.Pool is not a constructor
      at PostgresDriver.createPool (/projects/hw/src/driver/postgres/PostgresDriver.ts:1461:22)
      at PostgresDriver.connect (/projects/hw/src/driver/postgres/PostgresDriver.ts:340:38)
      at DataSource.initialize (/projects/hw/src/data-source/DataSource.ts:232:27)
      at Function.&lt;anonymous&gt; (/projects/hw/node_modules/@nestjs/typeorm/dist/typeorm-core.module.js:179:38)
      at Generator.next (&lt;anonymous&gt;)
  </code></pre>
  <p>What is causing this issue and how can I fix it?</p>