Skip to content

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

@jakub-holy-juicymo-cz

Description

@jakub-holy-juicymo-cz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions