Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I got 'Certificate has expired' error #4113

Closed
alpgul opened this issue Oct 1, 2021 · 7 comments
Closed

I got 'Certificate has expired' error #4113

alpgul opened this issue Oct 1, 2021 · 7 comments

Comments

@alpgul
Copy link

alpgul commented Oct 1, 2021

Describe the bug

Site request works fine on chrome with no certificate errors.

To Reproduce

Code

    const agent = new https.Agent({
      rejectUnauthorized: false,
    });

    this.request = axios.create({
      baseURL: BASE_URL,
      httpsAgent: agent,
      withCredentials: true,
      maxRedirects: 0,
    });
 const res = await this.request.get(PROFIL_URL);

Expected behavior

How to fix this error? how do i disable SSL verification?

Environment

  • Axios Version [v0.21.4]
  • Adapter [XHR/HTTP/GET]
  • Browser [Chrome]
  • Browser Version [v94.0.4606.71]
  • Node.js Version [v14.17.6]
  • OS: [Windows 10]
  • Additional Library Versions none

Additional context/Screenshots

@caugner
Copy link
Contributor

caugner commented Oct 1, 2021

Afaik Axios has no option to disable SSL verification.

If the PROFIL_URL you're requesting has a valid SSL certificate which is trusted by your browser, the request should succeed.

Would you have a chance to post screenshots (with sensitive information redacted)

  1. of the error in your browser's console,
  2. of the request in your browser's DevTools?

@caugner
Copy link
Contributor

caugner commented Oct 1, 2021

If the error occurs in a NodeJS context, you could try this workaround: #3304 (comment)

@alpgul
Copy link
Author

alpgul commented Oct 1, 2021

The same problem was in postman, but they released a fix and the problem was solved. Can Axios issue a fix for this problem?
postmanlabs/postman-app-support#10338
I don't get certificate error in postman and browser.

@caugner
Copy link
Contributor

caugner commented Oct 1, 2021

Could you try if updating to Node.js v14.18.0 fixes the issue for you?

@alpgul
Copy link
Author

alpgul commented Oct 1, 2021

Could you try if updating to Node.js v14.18.0 fixes the issue for you?

I updated it.But the problem continues. You can try this on stackoverflow.com. Same with DST Root CA X3 type certificate.
https://www.sslshopper.com/ssl-checker.html#hostname=stackoverflow.com

 const res = await this.request.get("https://stackoverflow.com");

@WebFreak001
Copy link

This might be because the old Let's Encrypt root certificate has expired: https://letsencrypt.org/docs/dst-root-ca-x3-expiration-september-2021/

Is the certificate store in axios hardcoded or does it load it from somewhere on the system? Adding the new root certificate on the device or wherever the certificate is loaded from will fix it for the next 4 years.

@alpgul
Copy link
Author

alpgul commented Oct 2, 2021

I found that the cause of the problem is due to vscode. It works fine in the current nodejs version. There is nothing to do. I'm waiting for vscode update the node version .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants