Open msambol opened 2 years ago
@chrisrhymes Tagging you since you posted something similar here.
@chrisrhymes Did you have success in getting past this?
running into same problem, were you able to fix this?
After digging into the code, it looks like the issue is that the RemoteGraphQLDataSource
objects use their own fetcher rather than the fetcher created in the gateway. ~It's definitely a bug, and as of now I don't see a workaround. I'll see if I can get a PR up for this tomorrow.~
@msambol @rsarangu
After getting a bit of an assist from a colleague, it turns out I misread the code. RemoteGraphQLDataSource
will in fact honor a custom fetcher passed in. I think if you change your buildService
function to something like this it should work.
buildService({ url }) {
return new AuthenticatedDataSource({
url,
fetcher: fetcher.defaults({
strictSSL: false
}),
})
},
Let me know how that works.
@clenfest I was able to get this to work, thanks for digging! Not fetcher.defaults
(I might be missing an import?), but the code below:
const gateway = new ApolloGateway({
buildService({ url }) {
return new AuthenticatedDataSource({
url,
fetcher: require('make-fetch-happen').defaults({
strictSSL: false
})
})
},
supergraphSdl: new IntrospectAndCompose({
subgraphs: controllers
})
})
Note for others: in my original code I had fetcher
as a param to ApolloGateway
and not AuthenticatedDataSource
(extends RemoteGraphQLDataSource
). @clenfest Are there improvements that can be made to the docs here? I see it in both places, but maybe that's allowed.
Also note, you shouldn't use strictSSL: false
in production!
I'm creating an instance of
ApolloServer
withApolloGateway
. I'm running it locally in dev but I get the following:Below is my code. I've tried to set
strictSSL
tofalse
formake-fetch-happen
. I've also tried settingNODE_TLS_REJECT_UNAUTHORIZED=0
.Dependencies:
Related: https://community.apollographql.com/t/apollo-gateway-local-dev-with-self-signed-certificates/2660.
Bug or am I doing something wrong?