nestjs / typeorm

TypeORM module for Nest framework (node.js) 🍇

Home Page:https://nestjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I reconnect to database?

zhaoyi0113 opened this issue · comments

I followed this instruction (https://docs.nestjs.com/techniques/database) to setup the Postgresql database connection with nestjs. I created a class to provide the connection options like:

export class PostgreeSql implements TypeOrmOptionsFactory{
   async createTypeOrmOptions(): Promise<TypeOrmModuleOptions> {
       const signer = new AWS.RDS.Signer(...)
       signer.getAuthToken({}, (err, token) => {
    ...
}

In the above method createTypeOrmOptions, it generates the password which is valid for 15 minutes. It works fine for the 15 minutes but after the password token expire, I will get authorization error response in my application. How can I force nestjs to reconnect with a new connect options?

Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.