node.jswindowssslaxioswindows-server

UNABLE_TO_VERIFY_LEAF_SIGNATURE | unable to verify the first certificate


This error has suddenly started occurring on all my servers, and despite trying everything suggested here, I haven't been able to resolve it. The issue persists regardless of the URL I attempt to access, including 'google.com', for instance. My environment consists of Windows Server 2019 and Node.js version 21.7.3. I've attempted making requests using both Axios and Node-fetch, but encountered the same error with both. Surprisingly, when using 'CURL', everything functions as expected. Below is an example of the code I've been working with.

const axios = require('axios');
axios.get('https://google.com')
  .then(function (response) {
    console.log(response);
  })
  .catch(function (error) {
    console.log(error);
  });

Solution

  • After hours of troubleshooting, I can confirm this is the recent Eset Internet Security update.

    The issue in my Node app appeared like this:

    Error occurred while trying to proxy request /elastic from localhost:8080 to https://myserver.example (UNABLE_TO_VERIFY_LEAF_SIGNATURE)
    

    What has helped in my case - settings of Eset Internet Security:

    1. Select Internet protection
    2. Open SSL/TLS submenu on the left
    3. Check rules for applications and certificates.
    4. If any of the certificate is blocked or set to "Automatic", change it to "Allowed" and "Scan action" change to ignore. Do this for certificates and urls you know. My problem was with a development stage server.

    Alternative solution: Turn "Enable HTTPS traffic scanning" completely off.