我在 Heroku 上的生产 Node 应用随机开始抛出以下错误:
Error: certificate has expired
at Error (native)
at TLSSocket.<anonymous> (_tls_wrap.js:1060:38)
at emitNone (events.js:86:13)
at TLSSocket.emit (events.js:185:7)
at TLSSocket._finishInit (_tls_wrap.js:584:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:416:38)
error: Forever detected script exited with code: 1
error: Script restart attempt #1
Creating a pool connected to blah.thing.com:port
Running migrations for database 'app_name'...
events.js:160
throw er; // Unhandled 'error' event
^
我对两件事感到困惑。我的证书是最新的,所以我不知道为什么它说它已过期,其次,我的应用程序目录中仅有的两个名为“events.js”的文件位于两个看似不相关的 Node 模块(inquirer 和 twilio)和 don甚至有第 160 行。这可能是什么原因造成的,我应该如何调试它?
编辑:此外,它只是生产应用程序(当然),而不是暂存或本地应用程序,这很奇怪,因为暂存和生产都指向同一个证书。
最佳答案
我在我的项目中有类似的错误
Error: certificate has expired
at TLSSocket.<anonymous> (_tls_wrap.js:1116:38)
at emitNone (events.js:106:13)
at TLSSocket.emit (events.js:208:7)
at TLSSocket._finishInit (_tls_wrap.js:643:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:473:38)
at TLSSocket.<anonymous> (_tls_wrap.js:1116:38)
at emitNone (events.js:106:13)
at TLSSocket.emit (events.js:208:7)
at TLSSocket._finishInit (_tls_wrap.js:643:8)
at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:473:38)
事实证明,问题出在用于跟踪用户事件 (Amplitude) 的外部服务中。他们的 Sectigo 遗留的 AddTrust 外部 CA 根证书已经过期,这影响了互联网上的许多公司。为解决该问题,他们使用新端点和新证书升级了他们的软件包。
因此,如果有人遇到类似问题,首先要考虑应用内可能使用的所有外部服务。
关于node.js - 错误 : certificate has expired in Node,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40412315/