简体   繁体   中英

Error: certificate has expired in Node

My production node app on Heroku randomly started throwing the following error:

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
       ^

I'm confused by two things. My certificate is up to date, so I don't know why it's saying it's expired, and second, the only two files called "events.js" in my app directory are in two seemingly irrelevant node modules (inquirer and twilio) and don't even have a line 160. What might be the cause of this and how should I even debug it?

edit: In addition, it's just the production app (of course), not staging or local, which is odd because staging and production both point to the same certificate.

I had similar error in my project

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)

it turned out that the problem was in the external service that was used for tracking user events (Amplitude). Their Sectigo's legacy AddTrust External CA Root certificate has expired which impacted many companies across the internet. To resolve the issue they have upgraded their package with the new endpoint and new certificate.

So if someone will met similar issue, first think of all possible external services that are used within the app.

I had the same problem, for me a remote "playground" server got expired certificate. (a server to which node was trying to connect through a web-socket)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM