VulcanJS / Vulcan

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

Error when deploy VulcanJS example-forum 1.8.5 #1826

Closed adalidda closed 6 years ago

adalidda commented 6 years ago

Hi,

I am testing VulcanJS 1.8.5 with example-forum package. On the local computer, it's running fine. When I deploy it to my server with pm2-meteor, the deploy terminate successfully with ok. But when I checked it on the server. I got the following error:

Warning: fragment with name UsersCurrent already exists. graphql-tag enforces all fragment names across your application to be unique; read more about this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names Warning: fragment with name UsersCurrent already exists. graphql-tag enforces all fragment names across your application to be unique; read more about this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names Warning: fragment with name UsersCurrent already exists. graphql-tag enforces all fragment names across your application to be unique; read more about this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names Warning: fragment with name UsersCurrent already exists. graphql-tag enforces all fragment names across your application to be unique; read more about this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names Warning: fragment with name UsersCurrent already exists. graphql-tag enforces all fragment names across your application to be unique; read more about this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection: TypeError: The loader.load() function must be called with a value,but got: undefined. at DataLoader.load (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/dataloader/index.js:44:13) at _callee$ (packages/vulcan:users/lib/schema.js:211:47) at tryCatch (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/regenerator-runtime/runtime.js:65:40) at GeneratorFunctionPrototype.invoke [as _invoke] (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/regen$ at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/n$ at tryCatch (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/regenerator-runtime/runtime.js:65:40) at invoke (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/regenerator-runtime/runtime.js:155:20) at /opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/regenerator-runtime/runtime.js:202:11 at new wrappedPromise (/usr/local/lib/node_modules/pm2/node_modules/async-listener/index.js:372:16) at callInvokeWithMethodAndArg (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/regenerator-runtime/runti$ You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection: TypeError: The loader.load() function must be called with a value,but got: undefined. at DataLoader.load (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/dataloader/index.js:44:13) at _callee$ (packages/vulcan:users/lib/schema.js:211:47) at tryCatch (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/regenerator-runtime/runtime.js:65:40) at GeneratorFunctionPrototype.invoke [as _invoke] (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/regen$ at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/n$ at tryCatch (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/regenerator-runtime/runtime.js:65:40) at invoke (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/regenerator-runtime/runtime.js:155:20) at /opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/regenerator-runtime/runtime.js:202:11 at new wrappedPromise (/usr/local/lib/node_modules/pm2/node_modules/async-listener/index.js:372:16) at callInvokeWithMethodAndArg (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/regenerator-runtime/runti$ You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection: TypeError: The loader.load() function must be called with a value,but got: undefined. at DataLoader.load (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/dataloader/index.js:44:13) at _callee$ (packages/vulcan:users/lib/schema.js:211:47) at tryCatch (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/regenerator-runtime/runtime.js:65:40) at GeneratorFunctionPrototype.invoke [as _invoke] (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/regen$ at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/n$ at tryCatch (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/regenerator-runtime/runtime.js:65:40) at invoke (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/regenerator-runtime/runtime.js:155:20) at /opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/regenerator-runtime/runtime.js:202:11 at new wrappedPromise (/usr/local/lib/node_modules/pm2/node_modules/async-listener/index.js:372:16) at callInvokeWithMethodAndArg (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/regenerator-runtime/runti$ Tue Aug 15 2017 05:04:14 GMT+0200 (CEST) 'error while server-rendering' 'Error: GraphQL error: The loader.load() function must be calle$ You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection: Error: {"id":"app.document_not_found","value":"tkjhst8ktqdz33kfi"} at Object.Utils.performCheck (packages/vulcan:lib/lib/modules/utils.js:459:11) at Object._callee$ (packages/vulcan:posts/lib/resolvers.js:47:13) at tryCatch (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/regenerator-runtime/runtime.js:65:40) at GeneratorFunctionPrototype.invoke [as _invoke] (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/npm/node_modules/regen$ at GeneratorFunctionPrototype.prototype.(anonymous function) [as next] (/opt/pm2-meteor/nova/adaV4-NOVA-EN/bundle/programs/server/n$

Notes:

  1. The local version and the deployed version used the same database that worked with the vulcanJS version n-1.
  2. NodeJS version 8.9.4 is installed on the server and local computer.
  3. I deployed with example-forum code as is, no modification to the code.

How can I fix it ?

Thank You Adalidda

MHerszak commented 6 years ago

I had this problem in the past but I can't replicate it today. The reason it appeared was that either a fragment did register and not extend the UsersCurrent (in package vulcan:users) or a component was directly imported instead of registered with registerComponent.

adalidda commented 6 years ago

Thank You MHerszak for your input.

MHerszak commented 6 years ago

Where you able to locate the problem?

adalidda commented 6 years ago

Not yet. Still look on it.

adalidda commented 6 years ago

Hi,

I am now able to deploy VulcanJS 1.8.5 with example-forum package by changing the setting in my pm2-meteor.json from: "exec_mode": "cluster_mode", to "exec_mode": "fork_mode",

It seems that the new requirement in Apollo that force the fragment name to be unique is not compatible with PM2 Cluster mode.

However, the deploy works only with fresh new database. Really need the migration script as mentioned by Sacha in his blog.

Thank You to all and in particular to coagmano that gave me the solution.

Adalidda