运行heroku命令时出现证书过期错误
Posted
技术标签:
【中文标题】运行heroku命令时出现证书过期错误【英文标题】:certificate has expired error whilst running heroku commands 【发布时间】:2021-12-16 14:03:20 【问题描述】:我正在尝试对 Heroku 上的托管应用执行以下操作-
创建数据库备份
下载数据库备份
在本地 postgres 数据库中恢复备份 但是,我被困在第一步本身。运行以下命令会引发以下错误 -
heroku pg:backups:capture -a app-name CERT_HAS_EXPIRED:证书已过期
我什至尝试运行以下命令,但是,这也无济于事 -
heroku run:detached pg:backups capture –a app-name
Running pg:backups:capture on ⬢ app-name... done, run.1879 (Free)
Run heroku logs --app app-name --dyno run.1879 to view the output.
(env) E:\new_website\>heroku logs --app app-name --dyno run.1879
2021-10-29T05:18:36.001962+00:00 heroku[run.1879]: Starting process with command pg:backups:capture
2021-10-29T05:18:36.564987+00:00 heroku[run.1879]: State changed from starting to up
2021-10-29T05:18:36.953570+00:00 app[run.1879]: bash: pg:backups:capture: command not found
2021-10-29T05:18:37.068925+00:00 heroku[run.1879]: Process exited with status 127
2021-10-29T05:18:37.103435+00:00 heroku[run.1879]: State changed from up to complete
最后,我还尝试使用 HEROKU_DEBUG 环境变量来查看真正的错误是什么 -
(env) E:\new_website\>SET HEROKU_DEBUG=1
(env) E:\new_website\>heroku pg:backups:capture --app app-name
Adding the following trusted certificate authorities
E:\ap01\Ruby\cacert.pem
--> POST /actions/addon-attachments/resolve
--> "app":"neevista-web","addon_attachment":"DATABASE_URL","addon_service":"heroku-postgresql"
<-- 200 OK
<-- ["addon":"id":"9ccc7a6d-8001-473a-8ef1-e24614ad26c0","name":"postgresql-curly-92807","app":"id":"587ec79f-3989-40eb-bceb-17220824a275","name":"app-name","plan":"id":"062a1cc7-f79f-404c-9f91-135f70175577","name":"heroku-postgresql:hobby-dev","app":"id":"587ec79f-3989-40eb-bceb-17220824a275","name":"app-name","id":"5a2ba589-22e6-4c42-a3bd-d634b4581eb5","name":"DATABASE","namespace":null,"created_at":"2021-06-21T15:05:48Z","updated_at":"2021-06-21T15:05:48Z","web_url":"https://addons-sso.heroku.com/apps/587ec79f-3989-40eb-bceb-17220824a275/addons/9ccc7a6d-8001-473a-8ef1-e24614ad26c0","log_input_url":null,"config_vars":["DATABASE_URL"]]
Adding the following trusted certificate authorities
E:\ap01\Ruby\cacert.pem
--> GET /client/v11/databases/9ccc7a6d-8001-473a-8ef1-e24614ad26c0
! CERT_HAS_EXPIRED: certificate has expired
Error: certificate has expired
at TLSSocket.onConnectSecure (_tls_wrap.js:1502:34)
at TLSSocket.emit (events.js:314:20)
at TLSSocket._finishInit (_tls_wrap.js:937:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:711:12)
我尝试更新 Heroku CLI,重新启动 Heroku 应用程序,但没有任何帮助。不确定这是否有帮助,但我在这台 Windows 机器上运行了两个版本(9 和 13)的 Postgresql,我的应用正在尝试使用版本 13。
您能否告知我在这里做错了什么,或者您是否有持续的问题?
【问题讨论】:
【参考方案1】:在 Heroku 支持未能提供帮助后,我终于自己弄清楚了,因为他们将此问题归类为本地问题。
出于某种原因,我之前设置了SSL_CERT_FILE
环境变量。此环境变量指向证书 pem 文件 -> E:\ap01\Ruby\cacert.pem
删除此环境变量后,heroku 命令再次开始工作。
【讨论】:
以上是关于运行heroku命令时出现证书过期错误的主要内容,如果未能解决你的问题,请参考以下文章