There are several services that process graphql-requests on relative URLs. Example: http://service:8080/graphql/a3333333-b111-c111-d111-e00000000011. And I don’t understand how to config apolloGateway that part of url is a variable.
Try config url as:
const test_service: string = 'http://service:8080/graphql/:project';
supergraphSdl: new IntrospectAndCompose({
subgraphs: [
{ name: 'test_service', url: test_service },
],
}),
So full service look like:
import { ApolloServer } from 'apollo-server'
import { ApolloGateway, IntrospectAndCompose, RemoteGraphQLDataSource } from '@apollo/gateway'
const test_service: string = 'http://service:8080/graphql/:project';
const gateway_main = new ApolloGateway({
supergraphSdl: new IntrospectAndCompose({
subgraphs: [
{ name: 'test_service', url: test_service },
],
}),
});
const server_main = new ApolloServer({
introspection: true,
gateway: gateway_main
});
server_main.listen(8060).then(({ url }) => {
console.log(`Server ready at ${url}`);
});
But if I send a request to url http://service:8060/graphql/a3333333-b111-c111-d111-e00000000011 test_service get it as http://service/graphql/:project So test_service lose uuid-data