Axios certificate has expired on valid certificate

Viewed 1208

Edit: This was caused by https://letsencrypt.org/docs/dst-root-ca-x3-expiration-september-2021, which letsencrypt certificates were becoming invalid after 30th Sep. Not sure why this question was close.

I have a backend service where I use let's encrypt tls certificates. For some reason, axios started throwing certificate has expired when reaching out the endpoint.

axios.get(`https://domain/path`, )

This is the error

Error: certificate has expired
    at TLSSocket.onConnectSecure (_tls_wrap.js:1484:34)
    at TLSSocket.emit (events.js:310:20)
    at TLSSocket._finishInit (_tls_wrap.js:927:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:697:12)

But when I inspect the certificate that comes from the API, you can see it was issued the 5th Sep and is valid until next December at least.

let cert = response.request.res.socket.getPeerCertificate(false);

returns

    {
      subject: [Object: null prototype] { CN: 'api.kafkaide.com' },
      issuer: [Object: null prototype] { C: 'US', O: "Let's Encrypt", CN: 'R3' },
      subjectaltname: 'DNS:api.kafkaide.com',
      infoAccess: [Object: null prototype] {
        'OCSP - URI': [ 'http://r3.o.lencr.org' ],
        'CA Issuers - URI': [ 'http://r3.i.lencr.org/' ]
      },
      modulus: 'ac5c86f0f52015bbfcb8b5374d54576a8710c73cd6c7c744888b7dd06dca0bc0d8b7538b4da92b579b94aeab659b47433ddccf2c05dd4e69b31701015d3f6802710232271c47c7d529d2b38f007b4cb538e7d5f9352bfbc1f34e884cd184c4c334fbcfd43adee81f0aacfc5156f8b75f17e5561944a46cffe837e781f6a20c3623eeb54fe5ad3ce1bcfdd3f0ff484a9cab3da381c82bc5c68cb814b50e6dcba388938333d7905e1adfc0e777708bb91728ce83f5abb0983fd1b500d508c2784b913698012e681719fb39dce76931defbf4cba3a21adc3894697b68f9c8124894c6466dd20e8a2d4fde76d3de440bd494949ea62d8a4e3dc75a50094ddf817e3d',
      bits: 2048,
      exponent: '0x10001',
      pubkey: <Buffer 30 82 01 22 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03 82 01 0f 00 30 82 01 0a 02 82 01 01 00 ac 5c 86 f0 f5 20 15 bb fc b8 b5 37 4d 54 57 6a 87 ... 244 more bytes>,
      valid_from: 'Sep  5 13:09:56 2021 GMT',
      valid_to: 'Dec  4 13:09:55 2021 GMT',
      fingerprint: '1F:F4:9F:42:2A:B8:03:E9:2D:B6:27:D9:68:B8:21:4F:89:B3:3A:8F',
      fingerprint256: '9C:1A:06:60:1A:6B:CD:49:52:E3:33:61:BE:35:F7:DF:5F:BE:7E:E9:4C:1F:34:14:AD:45:3D:05:CC:F2:8A:67',
      ext_key_usage: [ '1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2' ],
      serialNumber: '03a662418964e91df4be932d2ffbee3db62c',
      raw: <Buffer 30 82 05 25 30 82 04 0d a0 03 02 01 02 02 12 03 a6 62 41 89 64 e9 1d f4 be 93 2d 2f fb ee 3d b6 2c 30 0d 06 09 2a 86 48 86 f7 0d 01 01 0b 05 00 30 32 ... 1271 more bytes>
    }

Any idea why this doesn't work?

Also, when I access it directly through the browser, chrome doesn't complain. It actually says it's a valid certificate.

I'm using Axios "^0.21.4" and it's being used inside an electron application. The same behaviour happens in MacOSX and Ubuntu.

0 Answers
Related