-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
request <url> failed, reason: self signed certificate #19
Comments
This is most likely not a But if you are behind some MITM proxy, see #15 for possible solutions. |
Closing as no further comment received (unlikely a node-fetch issue). |
I added some code in
|
|
I did it like this: const https = require("https");
const agent = new https.Agent({
rejectUnauthorized: false
})
fetch(myUrl, { agent }) |
@johanhenrikssn any idea of the security implications of that "fix"? :) |
@samvloeberghs Using CA issued certificates is of course preferred in production to ensure information comes from a trusted source. I'm using this in development since the API I'm fetching from has a self-signed certificate in the staging environment. What are your thoughts about the security implications? |
For a safer option, you can also use
https://nodejs.org/api/https.html#https_https_request_options_callback |
@johanhenrikssn it didn't work out in my case.. I moved to https request. |
@johanhenrikssn worked for me fixing isomorphic-fetch and vue-apollo. Thanks.
|
This is also an environment variable you can set in later versions of node.js to suppress the certificate authorization:
or
|
This |
You can't even use the |
I used this es6 syntax and it worked for me. No need to set node global options. import https from "https";
const agent = new https.Agent({
rejectUnauthorized: false
});
fetch(myUrl, { agent }); |
Hi I tried
in the same file where I make the request
in root/.env All the above methods don't work for me, and I am still getting the same error.
|
@LiMengyang990726 What error are you getting? |
FetchError: request to failed, reason: self signed certificate |
@LiMengyang990726 Is the site you're trying to fetch using a self-signed certificate? |
I believe so. As I need to try to avoid the same thing in Postman and cULR |
Today, when I'm using node-fetch to request a facebook api end-point, I received "self signed certificate" error.
The text was updated successfully, but these errors were encountered: