graphql-hive / console

Hive Console is a GraphQL platform: schema registry, analytics and gateway for GraphQL federation and other GraphQL APIs
https://the-guild.dev/graphql/hive
MIT License
427 stars 102 forks source link

@graphql-hive/client throws TypeError #2816

Open shobhitsharma opened 1 year ago

shobhitsharma commented 1 year ago

Stacktrace

Failed to collect operation TypeError: Cannot read properties of undefined (reading 'definitions')
    at complete (/node_modules/.pnpm/@graphql-hive+client@0.24.1_graphql@16.6.0/node_modules/@graphql-hive/client/cjs/internal/usage.js:104:57)
    at Object.willSendResponse (/node_modules/.pnpm/@graphql-hive+client@0.24.1_graphql@16.6.0/node_modules/@graphql-hive/client/cjs/apollo.js:155:25)
    at /node_modules/.pnpm/@apollo+server@4.9.3_graphql@16.6.0/node_modules/@apollo/server/dist/cjs/requestPipeline.js:274:75
    at Array.map (<anonymous>)
    at invokeWillSendResponse (/node_modules/.pnpm/@apollo+server@4.9.3_graphql@16.6.0/node_modules/@apollo/server/dist/cjs/requestPipeline.js:274:44)
    at sendErrorResponse (/node_modules/.pnpm/@apollo+server@4.9.3_graphql@16.6.0/node_modules/@apollo/server/dist/cjs/requestPipeline.js:293:15)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async processGraphQLRequest (/node_modules/.pnpm/@apollo+server@4.9.3_graphql@16.6.0/node_modules/@apollo/server/dist/cjs/requestPipeline.js:51:24)
    at async internalExecuteOperation (/node_modules/.pnpm/@apollo+server@4.9.3_graphql@16.6.0/node_modules/@apollo/server/dist/cjs/ApolloServer.js:634:16)
dotansimha commented 1 year ago

Thanks @shobhitsharma , can you please share more details? what version of this package are you using? and what GraphQL server + NodeJS version are you running?

kamilkisiela commented 1 year ago
"@apollo/server": "4.9.3"
"@graphql-hive/client": "0.24.1"
"graphql": "16.6.0"
kamilkisiela commented 1 year ago

I can't reproduce it :(

kamilkisiela commented 1 year ago

Can you try 0.24.2-alpha-20230928151650-fb1f0fa0? In https://github.com/kamilkisiela/graphql-hive/pull/2979 I added a log message with an operation name when a DocumetNode is not available. It should help us narrow down the issue to a specific GraphQL operation.

imdadul commented 1 year ago

Can you try 0.24.2-alpha-20230928151650-fb1f0fa0? In #2979 I added a log message with an operation name when a DocumetNode is not available. It should help us narrow down the issue to a specific GraphQL operation.

Failed to collect operation TypeError: Cannot read properties of undefined (reading 'name')
    at Object.Field (/node_modules/.pnpm/@graphql-hive+client@0.24.2-alpha-20230928151650-fb1f0fa0_graphql@16.6.0/node_modules/@graphql-hive/client/cjs/internal/usage.js:253:54)
    at Object.enter (/node_modules/.pnpm/graphql@16.6.0/node_modules/graphql/utilities/TypeInfo.js:391:27)
    at visit (/node_modules/.pnpm/graphql@16.6.0/node_modules/graphql/language/visitor.js:197:21)
    at collect (/node_modules/.pnpm/@graphql-hive+client@0.24.2-alpha-20230928151650-fb1f0fa0_graphql@16.6.0/node_modules/@graphql-hive/client/cjs/internal/usage.js:249:29)
    at /node_modules/.pnpm/@graphql-hive+client@0.24.2-alpha-20230928151650-fb1f0fa0_graphql@16.6.0/node_modules/@graphql-hive/client/cjs/internal/utils.js:38:23
    at complete (/node_modules/.pnpm/@graphql-hive+client@0.24.2-alpha-20230928151650-fb1f0fa0_graphql@16.6.0/node_modules/@graphql-hive/client/cjs/internal/usage.js:122:54)
    at Object.willSendResponse (/node_modules/.pnpm/@graphql-hive+client@0.24.2-alpha-20230928151650-fb1f0fa0_graphql@16.6.0/node_modules/@graphql-hive/client/cjs/apollo.js:171:25)
    at /node_modules/.pnpm/@apollo+server@4.9.3_graphql@16.6.0/node_modules/@apollo/server/dist/cjs/requestPipeline.js:274:75
    at Array.map (<anonymous>)
    at invokeWillSendResponse (/node_modules/.pnpm/@apollo+server@4.9.3_graphql@16.6.0/node_modules/@apollo/server/dist/cjs/requestPipeline.js:274:44)"
kamilkisiela commented 1 year ago

@imdadul hmm to me it seems like GraphQLSchema is not in sync with GraphQL operation.

Can you try 0.24.3-alpha-20231005085447-ceb7a201? It should display operation's name and a location of the error (path to a field). Will you be able to create a reproduction?