You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The config.introspection property of a GraphQLHandler does not work properly. The problem comes from the fact that the GraphQLHandler expects the desctructuredschema property from the urlLoader.handleSDL function, which in turn does not provide such property. Instead the handleSDL provides the parsed document.
Error:
TypeError: Cannot read property 'getQueryType' of undefined
at /graphql-mesh-express/packages/backend/node_modules/@graphql-mesh/merger-stitching/index.js:31:57
at Array.map (<anonymous>)
at StitchingMerger.getUnifiedSchema (/graphql-mesh-express/packages/backend/node_modules/@graphql-mesh/merger-stitching/index.js:30:38)
at Object.getMesh (/graphql-mesh-express/packages/backend/node_modules/@graphql-mesh/runtime/index.js:105:46)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Potential solution:
I have a primitive solution proposal which is to return schema: graphql.buildSchema(schemaString) from the url loader but that touches another repo and probably it is better to have a solution here
@ardatan , even if the bug is solved I am not sure if the introspection property which expects a URL path to SDL is the best way. For our use case, it would be a bit difficult to use because we might not have access to the sdl of a particular data source. Maybe a batter way would be to support a property which expects an endpoint to be introspected instrospectionEndpoint or an instrospection query result. What do you think? If you agree with me I could try implementing this myself - change the introspection to an introspectionEndpoint and remove the urlLoad.handleSDL() ?
@ardatan , thank you very much. The issue is solved. We can now provide an introspection endpoint which is different than the endpoint for the data retrieval. This allows for moving forward with our encapsulation solution in which we use the same schema (introspected from service A) for 2 GraphQL Handlers with 2 different data retrieval endpoints (service A and Service B).
Do you think a recipe for what I described above with the encapsulation will be a good fit for the GQL Mesh docs? If that is the case I am up for adding this in the docs website
Describe the bug
The
config.introspection
property of aGraphQLHandler
does not work properly. The problem comes from the fact that the GraphQLHandler expects the desctructuredschema
property from theurlLoader.handleSDL
function, which in turn does not provide such property. Instead thehandleSDL
provides the parsed document.Error:
Potential solution:
schema: graphql.buildSchema(schemaString)
from the url loader but that touches another repo and probably it is better to have a solution hereintrospection
property which expects a URL path to SDL is the best way. For our use case, it would be a bit difficult to use because we might not have access to the sdl of a particular data source. Maybe a batter way would be to support a property which expects an endpoint to be introspectedinstrospectionEndpoint
or an instrospection query result. What do you think? If you agree with me I could try implementing this myself - change theintrospection
to anintrospectionEndpoint
and remove theurlLoad.handleSDL()
?To Reproduce
feature/reuse-introspected-schema
branchnpm start
from the root folderEnvironment:
Can be seen under https://github.com/Kiesen/graphql-mesh-express/tree/feature/reuse-introspected-schema
Additional context
Task 1) in to #2782
The text was updated successfully, but these errors were encountered: