node.js - 错误 : certificate has expired in Node

标签 node.js ssl heroku npm ssl-certificate

我在 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/

相关文章:

javascript - 语法错误: Unexpected token < : using angular 2 and webpack on heroku

iphone - iPod Touch 上的无效 SSL 证书错误 - 适用于 iPhone

ios - 如何从 iOS NSURLSession 访问 Node JS TLS 服务器

express - 如何使用 bin/www 为 node.js heroku 部署编写 Procfile?

node.js - serverless-offline 可选路径参数

ssl - 如何在Letscrypt中的SSL证书的PowerAdmin(PowerDNS)中添加CAA记录?

python - 如何将 Heroku 上的不同包要求到本地盒子?

node.js - 如何获取 nginx 中的 server_name 用作 Node 中的服务器变量

node.js - 尝试调用方法时获取 "Function: Bound"

node.js - OpenWhisk/Node —— Promise 未解决