Heroku Postgres Typeorm 迁移

时间:2021-02-21 04:37:45

标签: node.js postgresql heroku typeorm

我正在尝试在 Heroku 提供的数据库上执行我的迁移,但出现以下错误:

# Capture response from appcmd
    $response = .\appcmd list config 'Default Web Site/TestApp' /section:system.webServer/security/authorization

PS > Check-UserOrRoleExists -AppAuthConfig $response -User User1

True
PS > Check-UserOrRoleExists -AppAuthConfig $response -User User4

False
PS > Check-UserOrRoleExists -AppAuthConfig $response -User User3 -Role admin

False
PS > Check-UserOrRoleExists -AppAuthConfig $response -User User1 -Role admin

True
PS > Check-UserOrRoleExists -AppAuthConfig $response -Role admin            

True

ormconfig.js

Error during migration run:
Error: self signed certificate
    at TLSSocket.onConnectSecure (_tls_wrap.js:1501:34)
    at TLSSocket.emit (events.js:315:20)
    at TLSSocket._finishInit (_tls_wrap.js:936:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:710:12) {
  code: 'DEPTH_ZERO_SELF_SIGNED_CERT'
}

1 个答案:

答案 0 :(得分:2)

module.exports = {
  type: `postgres`,
  url: `${process.env.DATABASE_URL}`,
  entities: [`${process.env.DATABASE_ENTITIES}`],
  migrations: [`${process.env.DATABASE_MIGRATIONS}`],
  cli: { migrationsDir: `${process.env.DATABASE_MIGRATIONS_DIR}` },
  extra: {
    ssl: {
      rejectUnauthorized: false,
    }
  }
};

工作正常!