openapi-to-graphql
openapi-to-graphql copied to clipboard
self signed certificate
Describe the bug I have a LB4 application instance, which listens on https; Since it's a development environment, it is signed by a self-signed certificate. When I either try to generate the graphql endpoint or operate it, it fails to communicate with my lb4 app. I think there is a flag missing for trusting a self signed certificate, or maybe I misunderstand regarding how to opreate this tool.
I would appreciate any help.
Thanks, Tomer.
@TomerSalton To be honest, I am not too familiar with working with certificates.
We use the request module to make our calls. I found this issue that mentions setting the option rejectUnauthorized
to false. While I do not see this option mentioned in the documentation, I think it's worth a shot.
Are you currently using the library or the CLI? If it's the former, we have a requestOptions
option that allows you to directly interface with the request
module. You can try setting the requestUnauthorized
option to false and see if it fixes your problem.
Let me know how it goes!
I think the requestsOptions
that Alan mentions is the way to go here. You can try setting strictSSL
to false
, which will in turn set rejectUnauthorized
to false
. Consider the request documentation's note about the SSL option, though:
Note: to use your own certificate authority, you need to specify an agent that was created with that CA as an option.
@TomerSalton Were you able to resolve this issue?
I had the same issue as @TomerSalton , and using the requestOptions
did the trick to use a self signed certificate.
Here is an example of the configuration I used:
async function startServer() {
...
const oas = require('./oas.json');
const {schema} = await OtG.createGraphQLSchema(oas, {
requestOptions: {
rejectUnauthorized: false,
insecure: true,
strictSSL: false,
},
});
...
I just threw all three options rejectUnauthorized
, insecure
, and strictSSL
because for some people some options might work and others won't, as discussed here.
Thank you for your help @ErikWittern @hazi98 .
@Alan-Cha - as I am currently not working on it, maybe it is a good idea to close the issue. When I will have the time to test it, if it will not work, I might re-open.
@TomerSalton No worries! I'll keep the issue open so that people can continue discussing but do not feel pressured to work on it. I hope that is fine?