VulcanJS / Vulcan-Starter

VulcanJS starter repo. Use as a base for your own VulcanJS projects.
MIT License
127 stars 88 forks source link

GraphQL error when running example-forum 1.11.2 deployed with mup #65

Closed adalidda closed 5 years ago

adalidda commented 6 years ago

Hi,

My app was deployed successfully. However when running on the server, I got the following error: Error: GraphQL error: Unknown type "MultiPostInput". Did you mean "PostsInput"? Error: GraphQL error: Unknown type "MultiCategoryInput". Did you mean "CategoriesInput"?

I don't know why this happen as my app works fine on localhost.

In my mup.js I used abernix/meteord:node-8.11.2-base

You can see this error online at https://nova.adalidda.com

Error: GraphQL error: Unknown type "MultiPostInput". Did you mean "PostsInput"? GraphQL error: Cannot query field "posts" on type "Query". at new t (e5b7beeaf0a18185dcdb2ae21eaec5e0b18103c7.js?meteor_js_resource=true:7) at n.currentResult (e5b7beeaf0a18185dcdb2ae21eaec5e0b18103c7.js?meteor_js_resource=true:7) at s.dataForChild (e5b7beeaf0a18185dcdb2ae21eaec5e0b18103c7.js?meteor_js_resource=true:7) at s.render (e5b7beeaf0a18185dcdb2ae21eaec5e0b18103c7.js?meteor_js_resource=true:7) at s (e5b7beeaf0a18185dcdb2ae21eaec5e0b18103c7.js?meteor_js_resource=true:7) at beginWork (e5b7beeaf0a18185dcdb2ae21eaec5e0b18103c7.js?meteor_js_resource=true:7) at r (e5b7beeaf0a18185dcdb2ae21eaec5e0b18103c7.js?meteor_js_resource=true:7) at i (e5b7beeaf0a18185dcdb2ae21eaec5e0b18103c7.js?meteor_js_resource=true:7) at a (e5b7beeaf0a18185dcdb2ae21eaec5e0b18103c7.js?meteor_js_resource=true:7) at E (e5b7beeaf0a18185dcdb2ae21eaec5e0b18103c7.js?meteor_js_resource=true:7) e5b7beeaf0a18185dcdb2ae21eaec5e0b18103c7.js?meteor_js_resource=true:115 Error: GraphQL error: Unknown type "MultiCategoryInput". Did you mean "CategoriesInput"? GraphQL error: Cannot query field "categories" on type "Query". Did you mean "CategoriesList", "CategoriesTotal", or "CategoriesSingle"? at new t (e5b7beeaf0a18185dcdb2ae21eaec5e0b18103c7.js?meteor_js_resource=true:7) at n.currentResult (e5b7beeaf0a18185dcdb2ae21eaec5e0b18103c7.js?meteor_js_resource=true:7) at s.dataForChild (e5b7beeaf0a18185dcdb2ae21eaec5e0b18103c7.js?meteor_js_resource=true:7) at s.render (e5b7beeaf0a18185dcdb2ae21eaec5e0b18103c7.js?meteor_js_resource=true:7) at s (e5b7beeaf0a18185dcdb2ae21eaec5e0b18103c7.js?meteor_js_resource=true:7) at beginWork (e5b7beeaf0a18185dcdb2ae21eaec5e0b18103c7.js?meteor_js_resource=true:7) at r (e5b7beeaf0a18185dcdb2ae21eaec5e0b18103c7.js?meteor_js_resource=true:7) at i (e5b7beeaf0a18185dcdb2ae21eaec5e0b18103c7.js?meteor_js_resource=true:7) at a (e5b7beeaf0a18185dcdb2ae21eaec5e0b18103c7.js?meteor_js_resource=true:7) at E (e5b7beeaf0a18185dcdb2ae21eaec5e0b18103c7.js?meteor_js_resource=true:7)

Thank You adalidda

SachaG commented 6 years ago

Are you using the 2-repo install with the core repo on the devel branch?

adalidda commented 6 years ago

I am using git clone https://github.com/VulcanJS/Vulcan-Starter.git git clone https://github.com/VulcanJS/Vulcan.git

Thank You Adalidda

SachaG commented 6 years ago

In that case you need to switch to the master branch for https://github.com/VulcanJS/Vulcan

adalidda commented 6 years ago

Thank You @SachaG

adalidda commented 6 years ago

Dear @SachaG

I would like to confirm that after git clone -b master https://github.com/VulcanJS/Vulcan

I deploy example-forum successfully and its work fine.

Thank You so much Adalidda

jwrubel commented 5 years ago

I just came across this, after having set up a local project using the two-repo install (but left the Vulcan core repo on devel. I've made some fairly significant changes to the core repo, and now that I've deployed the app I am seeing a similar error when editing a post: Cannot query field "categories" on type "Query". Did you mean "CategoriesList", "CategoriesTotal", or "CategoriesSingle"?", which is thrown from here. Simply replacing the custom gql with one of the fragment names doesn't work either. I started down the path of merging in the Vulcan master branch but there are quite a lot of divergences and changes. @SachaG would you be able to give me a pointer as to where this might be failing? The file in Vulcan-Starter hasn't changed in months so I'm guessing it's in one of the core libraries closer to the graphql layer, but I'm not familiar enough with the Vulcan codebase to be able to figure out why this is failing in production but works fine on my local machine. If it helps, on production I'm deploying to a digitalocean droplet using mup, and the db is the hosted version from mongodb cloud.

SachaG commented 5 years ago

Did you mean "CategoriesList", "CategoriesTotal", or "CategoriesSingle"?"

Those are all the old, deprecated names of Vulcan's generated query types, while categories is the new name. So it sounds like somehow your front-end is using a recent Vulcan version while your back-end is using an older one.

The most probable reason is that your deployed instance of the app is not using the latest version of Vulcan packages. I'd try specifying versions (1.12.13) explicitly or (if you're using the 2-repo install) making sure that the bundling process is properly using your copy of the core repo.

Or, another reason could be that you have this older version of Vulcan running somewhere which your front-end is trying to connect to instead of connecting to the right server. I'd double-check your GraphQL endpoint URL in your devtools' Network tab.

jwrubel commented 5 years ago

Hmm - My deploy command (I am using the 2-repo install) is referencing METEOR_PACKAGE_DIRS to point to my local repo, like this: METEOR_PACKAGE_DIRS="../../Vulcan/packages" NODE_ENV=production mup deploy --settings "../beta.settings.json". I did set this environment up a few months ago and have been developing locally. I only recently attempted to deploy the app for the first time. Since I'm starting my local server with the same METEOR_PACKAGE_DIRS I figured it would bundle the same version with mup deploy.

I do see that my .meteor/packages file only specifies the following, outside of my package:

vulcan:core@1.11.2

############ Language Packages ############

vulcan:i18n-en-us

############ Accounts Packages ############

# accounts-password@1.5.1
accounts-twitter@1.4.2
accounts-google@1.3.2
accounts-github@1.4.2

the .meteor/packages file in my Vulcan directory doesn't specify a version on vulcan:core, but I'm not sure that it's even being used.

jwrubel commented 5 years ago

I just found your comment over on meteor-up (https://github.com/zodern/meteor-up/issues/442#issuecomment-323878027) - I wonder if this is what's going on.

SachaG commented 5 years ago

Yeah I would recommend setting up the package dirs through the PATH rather than with the METEOR_PACKAGE_DIRS option. I can confirm that this method works.

SachaG commented 5 years ago

Glad that it works now! And yeah a PR would be great :)