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
Error "certificate has expired" #568
Comments
This is not an issue. |
Gracias por la aclaración, lo había intentado colocando un catch pero sali ese error, pero al ver tu respuesta y volverlo a intentar salio, errores, que pasan |
I'm having this error in an Electron app using It only happens to some users so I'm guessing Node or Any idea what might be happening? |
@PierBover If you're using Electron, wouldn't the fetch API be natively supported in the browser window? |
@Richienb yes but in this case I need to do the request in the Node part since this involves working with the filestystem. |
Apparently the default config on the HTTPS agent is to cache 100 TLS sessions: https://nodejs.org/api/https.html#https_class_https_agent I will try passing a custom agent to node-fetch and see if that fixes it. Edit: No, that didn't work. I created an agent without SSL caching and passed it to const agent = new https.Agent({
maxCachedSessions: 0
});
const headers = {
'Authorization': 'Bearer ' + token
};
const options = {
headers,
agent
}
const response = await fetch('/endpoint', options); The only thing that fixes it is using this insecure hack: process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0; Edit 2: So we've tried with the |
Hi @PierBover did you find out the issue? And I'm having a |
Me too , are u using let's encrypt ? |
We were facing the same issue. Did the following as a quick fix: const https = require("https");
// custom agent as global variable
const agent = new https.Agent({
rejectUnauthorized: false,
});
// node-fetch request with custom agent
const response = await fetch(config.get('url'),
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `data=${JSON.stringify(payload)}`,
agent,
}); |
Hi @pigochu yes, I'm using let's encrypt. This started to happen all of the sudden. process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0; Note this should NOT be done, this is a temporary fix. |
Sorry guys, I don't remember how I solved that and don't have access to the repo anymore. |
For anyone arriving here with a Thank you Luca for the help ✌ |
The same error. |
They backported the fix to 12.2.1, 13.5.1, 14.1.0, 15.1.0, and 16 beta |
This worked for me. Should this be a temporary solution? |
Old node fetch library breaks stuff. Fix by setting rejectUnauthorized flag to false by default node-fetch/node-fetch#568 (comment)
Can anyone tell me whether this solution is legal for a production level node.js application, or it is not applicable? |
@kanishkab1 It probably depends on what kind of product you are building. If it's something that is heavily regulated - there might be legal consequences. You should never use this in production anyways, as it leaves you vulnerable for man in the middle attacks. |
Al ejecutar un modulo que depende de node-fetch encontre este error de autenticación.
The text was updated successfully, but these errors were encountered: