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
I have a bug related to the plugin apollo-server-plugin-response-cache.
Expected:
When the client sends a not well-formed request, server must answers with GraphQL error and validation details. Example of correct answer { name: 'ValidationError', message: 'Cannot query field "accommodations_foo" on type "Query". Did you mean "accommodations"?', code: 'GRAPHQL_VALIDATION_FAILED' } [ 'Cannot query field "accommodations_foo" on type "Query". Did you mean "accommodations"?',
Actually:
The client received the bag. Trace: { name: 'TypeError', message: 'Cannot read property \'operation\' of undefined', code: 'INTERNAL_SERVER_ERROR' } [ 'TypeError: Cannot read property \'operation\' of undefined', at isGraphQLQuery (/home/***/node_modules/apollo-server-plugin-response-cache/src/ 2:36)', at Object.<anonymous> (/home/***/node_modules/apollo-server-plugin-response-cache/ s:224:16)', at Generator.next (<anonymous>)', at /home/***/node_modules/apollo-server-plugin-response-cache/dist/ApolloServerPlu at new Promise (<anonymous>)', at __awaiter (/home/***/node_modules/apollo-server-plugin-response-cache/dist/Apolo, at Object.willSendResponse (/home/***/node_modules/apollo-server-plugin-response-cache/dist/ApolloServerPluginResponseCache.js:92:28)',
Example of fix (just add checking of existing the operation level: function isGraphQLQuery(requestContext) { return requestContext.operation && requestContext.operation.operation === 'query'; }
By the way, I'm developing my service on JavaScript, not TypeScript. Maybe it will help you navigate the nature of the error
The text was updated successfully, but these errors were encountered:
Hey guys
I have a bug related to the plugin apollo-server-plugin-response-cache.
Expected:
When the client sends a not well-formed request, server must answers with GraphQL error and validation details. Example of correct answer
{ name: 'ValidationError', message: 'Cannot query field "accommodations_foo" on type "Query". Did you mean "accommodations"?', code: 'GRAPHQL_VALIDATION_FAILED' } [ 'Cannot query field "accommodations_foo" on type "Query". Did you mean "accommodations"?',
Actually:
The client received the bag. Trace:
{ name: 'TypeError', message: 'Cannot read property \'operation\' of undefined', code: 'INTERNAL_SERVER_ERROR' } [ 'TypeError: Cannot read property \'operation\' of undefined', at isGraphQLQuery (/home/***/node_modules/apollo-server-plugin-response-cache/src/ 2:36)', at Object.<anonymous> (/home/***/node_modules/apollo-server-plugin-response-cache/ s:224:16)', at Generator.next (<anonymous>)', at /home/***/node_modules/apollo-server-plugin-response-cache/dist/ApolloServerPlu at new Promise (<anonymous>)', at __awaiter (/home/***/node_modules/apollo-server-plugin-response-cache/dist/Apolo, at Object.willSendResponse (/home/***/node_modules/apollo-server-plugin-response-cache/dist/ApolloServerPluginResponseCache.js:92:28)',
Would be great to fix the logic here:
apollo-server/packages/apollo-server-plugin-response-cache/src/ApolloServerPluginResponseCache.ts
Line 132 in bfe900d
Example of fix (just add checking of existing the operation level:
function isGraphQLQuery(requestContext) { return requestContext.operation && requestContext.operation.operation === 'query'; }
By the way, I'm developing my service on JavaScript, not TypeScript. Maybe it will help you navigate the nature of the error
The text was updated successfully, but these errors were encountered: