graphql-mesh/compose cannot consume graph generated by itself
Issue workflow progress
Progress of the issue based on the Contributor Workflow
Describe the bug
graphql-mesh/compose cannot consume graph generated by itself
To Reproduce Steps to reproduce the behavior:
run:
$ npm i @graphql-mesh/compose-cli
$ npm i @graphql-hive/gateway
create 2 files:
mesh.orig.ts
import {
defineConfig,
loadGraphQLHTTPSubgraph
} from '@graphql-mesh/compose-cli'
export const composeConfig = defineConfig({
subgraphs: [
/**/{
sourceHandler: loadGraphQLHTTPSubgraph('MortyB', {
endpoint: 'https://rickandmortyapi.com/graphql'
}),
},
]
})
mesh.hive.ts
import {
defineConfig,
loadGraphQLHTTPSubgraph
} from '@graphql-mesh/compose-cli'
export const composeConfig = defineConfig({
subgraphs: [
/**/{
sourceHandler: loadGraphQLHTTPSubgraph('MortyB', {
endpoint: 'http://localhost:5001/graphql'
}),
},
]
})
run following
$ npx mesh-compose -c mesh.orig.ts -o supergraph_orig.graphql
$ npx hive-gateway -p 5001 supergraph_orig
in other terminal run
$ npx mesh-compose -c mesh.hive.ts -o supergraph_hive.graphql
error message:
ERROR [Mesh Compose, subgraph=MortyB] Schema must contain uniquely named types but contains multiple types named "TransportOptions".
ERROR [Mesh Compose, subgraph=MortyB] Failed to load subgraph
Expected behavior
The graph can be composed and used
Sorry I didn't understand the setup you have. Could you please create a reproduction on CodeSandbox? Thanks!
https://codesandbox.io/p/devbox/thirsty-fog-88k2gk?workspaceId=ws_Rx9GNSkTDnZhrmVKawUzZK
there are two commands, "start" is the started server, and "start2" tries to extract graphql from it and compose it ...
my final goal is to be able to chain supergraphs into supersupergraph, possibly even to supersupersupergraph :-)
Unfortunatrly that kind of chaining is not possible today