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.
Thanks, I have open a post in stackoverflow: https://stackoverflow.com/questions/64552100/how-can-i-periodically-generate-db-connection-password-with-nestjs-typeorm