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
Ignore self-signed certificate #125
Comments
+1 |
Hey 👋, Could you try using process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0 I have taken it from this StackOverflow thread. Let me know if it solved your problem. 🙂 |
I forgot to report back here, but indeed, since I was using a self-signed certificate, it was complaining. Setting that variable worked for me. |
@remino that's great! I will close the issue as it seems to be resolved now 🙂 |
Form the docs - https://nodejs.org/api/cli.html#cli_node_tls_reject_unauthorized_value
Is there any other approach we can use? |
+1 |
@chrisjensen check this out to skip validation just for a request and not disable TLS validation for the whole application import https from 'https'
import { GraphQLClient } from 'graphql-request'
const httpsAgent = new https.Agent({ rejectUnauthorized: false })
const client = new GraphQLClient(GRAPHQL_URI, { agent: httpsAgent }) |
Is it working for you? because it doesn't have an agent option in new GraphQLClient constructor |
It’s working to me. If you follow this.options here https://github.com/prisma-labs/graphql-request/blob/26711e741a3966f10e34b907ec9e76d214e88d1f/src/index.ts#L216 There’re a lot of other options which are undocumented on this library because are just part of the fetch api itself. Would rather be better specifying that’s possible to tweak them this way.. |
The typescript signature does not seem to allow for an |
This worked for me! |
Connecting with graphql api with below code:
ERROR
Server is using self-signed certificate. How can I ignore the warning and add an exception?
The text was updated successfully, but these errors were encountered: