VulcanJS / Vulcan

🌋 A toolkit to quickly build apps with React, GraphQL & Meteor
http://vulcanjs.org
MIT License
7.98k stars 1.88k forks source link

Unhandled error in result reducer [TypeError: Cannot read property 'new' of undefined] #1641

Closed krishnapsms closed 5 years ago

krishnapsms commented 7 years ago

I am start working out with example-movie package to create quiz package i can't identify the following error while rendering it. Please help me further on this issue. QuizzesList.jsx

I20170524-19:05:12.234(5.5)? { [Error: GraphQL error: Cannot query field "undefined" on type "Query".] I20170524-19:05:12.235(5.5)? graphQLErrors: I20170524-19:05:12.236(5.5)? [ { message: 'Cannot query field "undefined" on type "Query".', I20170524-19:05:12.236(5.5)? locations: [Object] } ], I20170524-19:05:12.236(5.5)? networkError: null, I20170524-19:05:12.237(5.5)? message: 'GraphQL error: Cannot query field "undefined" on type "Query".', I20170524-19:05:12.237(5.5)? extraInfo: undefined, I20170524-19:05:12.237(5.5)? queryErrors: [ [Circular] ] } W20170524-19:05:12.239(5.5)? (STDERR) Wed May 24 2017 19:05:12 GMT+0530 (India Standard Time) 'error while server-rendering' 'Error: GraphQL error: Cannot query field "undefined" on type "Query".\n at ApolloError.Error (native)\n at new ApolloError (E:\Krishna\VulcanProjects\Vulcan-master\node_modules\apollo-client\apollo.umd.js:1959:28)\n at E:\Krishna\VulcanProjects\Vulcan- master\node_modules\apollo-client\apollo.umd.js:2827:41\n at E:\Krishna\VulcanProjects\Vulcan-master\node_modules\apollo-client\apollo.umd.js:3262:25\n at Array.forEach (native)\n at E:\Krishna\VulcanProjects\Vulcan-master\node_modules\apollo-client\apollo.umd.js:3259:27\n at Array.forEach (native)\n at QueryManager.broadcastQueries (E:\Krishna\VulcanProjects\V ulcan-master\node_modules\apollo-client\apollo.umd.js:3256:42)\n at QueryManager.broadcastNewStore (E:\Krishna\VulcanProjects\Vulcan-master\node_modules\apollo-client\apollo.umd.js:2631: 14)\n at E:\Krishna\VulcanProjects\Vulcan-master\node_modules\apollo-client\apollo.umd.js:3314:44\n => awaited here:\n at Function.Promise.await (C:\Users\Probe7\AppData\Local\.mete or\packages\promise\0.8.8\npm\node_modules\meteor-promise\promise_server.js:35:12)\n at Object.options.preRender (packages/vulcan:routing/lib/server/routing.jsx:52:22)\n at generateSSRD ata (packages/vulcan:routing/lib/server/router.jsx:51:15)\n at sendSSRHtml (packages/vulcan:routing/lib/server/router.jsx:79:25)\n at packages/vulcan:routing/lib/server/router.jsx:136:11\n at E:\Krishna\VulcanProjects\Vulcan-master\node_modules\react-router\lib\match.js:67:5\n at E:\Krishna\VulcanProjects\Vulcan-master\node_modules\react-router\lib\createTransitionMan ager.js:108:11\n at done (E:\Krishna\VulcanProjects\Vulcan-master\node_modules\react-router\lib\AsyncUtils.js:79:19)\n at E:\Krishna\VulcanProjects\Vulcan-master\node_modules\react -router\lib\AsyncUtils.js:85:7\n at getComponentsForRoute (E:\Krishna\VulcanProjects\Vulcan-master\node_modules\react-router\lib\getComponents.js:11:5)'

SachaG commented 7 years ago

It would be really useful to have the full error with good code formatting, that would help with debugging.

krishnapsms commented 7 years ago

I've edited my issue for better understanding please ask further anything if needed for debugging

SachaG commented 7 years ago

Did you define the QuizzesItemFragment fragment? What does it look like? Also check out http://docs.vulcanjs.org/debugging.html

krishnapsms commented 7 years ago

Yes I've added it as below

import { registerFragment } from 'meteor/vulcan:core';

registerFragment( fragment QuizzesItemFragment on Quiz { _id QuizTitle QuizDescription } );

krishnapsms commented 7 years ago

Now i got the following error @SachaG Please help me Error: GraphQL error: Cannot query field "undefined" on type "Query".

SachaG commented 7 years ago

Maybe the Quiz type isn't defined? I'll add a section about debugging your schema to that docs page.

SachaG commented 7 years ago

http://docs.vulcanjs.org/debugging.html#GraphQL-Schema-Issues