Apollo federation - self signed certificate in certificate chain error with subgraph

Hi,
I am trying to implement apollo federation with multiple subgraphs. I am able to create supergraph and start the server locally, however getting “self signed certificate in certificate chain” error when issuing query. The subgraphs are protected with company authorization. Following is the main code for apollo gateway.

I tried setting NODE_TLS_REJECT_UNAUTHORIZED to false but doesn’t seem to have any effect.

Any suggestions on what I can do for the error?

const { ApolloServer } = require(‘apollo-server’);
const { ApolloGateway, RemoteGraphQLDataSource } = require(‘@apollo/gateway’);
const { readFileSync } = require(‘fs’);

const supergraphSdl = readFileSync(‘./supergraph.graphql’).toString();

class AuthenticatedDataSource extends RemoteGraphQLDataSource {
willSendRequest({ request, context }) {

//Sending hard coded token value for testing locally
return ‘Bearer’ +

}
}

const gateway = new ApolloGateway({
supergraphSdl,
buildService({ name, url }) {
return new AuthenticatedDataSource({ url });
},
subscriptions: false,
NODE_TLS_REJECT_UNAUTHORIZED: false

});

Thank You,
const server = new ApolloServer({
gateway

});

server.listen().then(({ url }) => {
console.log(🚀 Gateway ready at ${url});
}).catch(err => {console.error(err)});

same issue for me, were you able to fix it?

No, I wasn’t able to run it locally. It looks like issue is only to run locally, I think it needs downloading the valid certificate and using it. I couldn’t make it work, I ended up deploying to our dev server.