Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graphql-mesh/compose cannot consume graph generated by itself #8559

Open
jakub-holy-juicymo-cz opened this issue Mar 27, 2025 · 3 comments
Open
Assignees

Comments

@jakub-holy-juicymo-cz
Copy link

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

@ardatan
Copy link
Owner

ardatan commented Mar 27, 2025

Sorry I didn't understand the setup you have. Could you please create a reproduction on CodeSandbox? Thanks!

@jakub-holy-juicymo-cz
Copy link
Author

jakub-holy-juicymo-cz commented Mar 28, 2025

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 :-)

@ardatan
Copy link
Owner

ardatan commented Mar 28, 2025

Unfortunatrly that kind of chaining is not possible today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants