Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GraphQL versions mismatch between latest ParseServer and latest ParseDashboard #1656

Closed
3 tasks done
stepanic opened this issue Feb 19, 2021 · 13 comments
Closed
3 tasks done

Comments

@stepanic
Copy link

Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Dashboard!

  • You're running version >=1.0.23 of Parse Dashboard.

  • You're running version >=2.3.2 of Parse Server.

  • You've searched through existing issues. Chances are that your issue has been reported or resolved before.

Environment Setup

Latest versions at 2021-02-19

NestJS 7.6.12
ParseServer 4.5.0
ParseDashboard 2.1.0

Steps to reproduce

ParseServer and ParseDashboard are configured as global middleware at NestJS which is on top od Express.js.

Error message:
Cannot use GraphQLObjectType \"RoleConnection\" from another module or realm.\n\nEnsure that there is only one instance of \"graphql\" in the node_modules\ndirectory. If different versions of \"graphql\" are the dependencies of other\nrelied on modules, use \"resolutions\" to ensure only one version is installed.\n\nhttps://yarnpkg.com/en/docs/selective-version-resolutions\n\nDuplicate \"graphql\" modules cannot be used at the same time since different\nversions may have different capabilities and behavior. The data from one\nversion used in the function from another could produce confusing and\nspurious results.

When ParseDashboard is removed from package.json.dependencies everything works.

Latest ParseDashboard has dependency to the [email protected] but the latest ParseServer has [email protected] which is not compatibile.

Also setting the npm resolutions in package.json to use [email protected] does not help.

I've tried to increase graphql at ParseDashboard with own fork to 15.4.0 but then build crashes.

Now only option to have the latest ParseServer and the latest ParseDashboard in the same Node.js app is not possible :(

Implementation of ParseServer and ParseDashboard in the same Node.js (NestJS) app

require('dotenv').config()

// Only for testing purposes it is able to override NODE_ENV with ENVIRONMENT
const ENVIRONMENT = process.env.ENVIRONMENT || process.env.NODE_ENV || 'dev'

import { getParseDashboard, getParseServer, getLiveQueryServer, getParseGraphQLServer } from './app/parse/parse.module';

import { Logger } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';

import { AppModule } from './app/app.module';

async function bootstrap(): Promise<void> {
  console.log('ENVIRONMENT', ENVIRONMENT);

  const app = await NestFactory.create(AppModule, { cors: true });
  const globalPrefix = 'api';
  app.setGlobalPrefix(globalPrefix);

  // Define Parse-Server and Parse-Dashboard as global middleware(s)
  const parseServer = getParseServer();
  // ParseServer GraphQL
  const parseGraphQLServer = getParseGraphQLServer(parseServer, '/graphql')

  app.use('/parse', parseServer.app);
  app.use('/dashboard', getParseDashboard());

  // Mounts the GraphQL API
  // GraphQL Playground is not mounted for security reasons but it is available in the ParseDashboard in the API Console/GraphQL
  parseGraphQLServer.applyGraphQL(app);

  const port = process.env.PORT || 3333;
  await app.listen(port, () => {
    Logger.log('Listening at http://localhost:' + port + '/' + globalPrefix);
  });

  getLiveQueryServer(app.getHttpServer());

}

bootstrap();

Logs/Trace

Note: If you get a browser JS error please run npm run dev. This will provide source maps and a much more useful stack trace.

@ivegner
Copy link

ivegner commented Mar 17, 2021

I worked around this by making a dummy npm package, adding parse-dashboard as a dependency, and calling parse-dashboard via the npm start script:

mkdir dashboard && cd dashboard
npm init -y
npm install parse-dashboard
touch parse-dashboard-config.json  # fill in the config as necessary 

and add the following to package.json:

  "scripts": {
    "start": "parse-dashboard --dev --config parse-dashboard-config.json"
  },

Start the dashboard with npm start and everything is okay.

@stepanic
Copy link
Author

@ivegner thanks, this is the nice workaround but still this issue should be solved because when running Parse Dashboard as separate process it should be mounted to the different port but for example Heroku or Google Cloud Run could expose process to some endpoint from one Docker Container only for one process not for both ParseServer and ParseDashboard :(

My workaround was to completely remove parse-dashboard from my Nest.js app and kept only parse-server and in that case this micro service is simpler.

And now I have 8 ParseServers as standalone processes at Heroku and Google Cloud Run and also 1 ParseDashboard at Google Cloud Run which has access to all 8 ParseServers instead of monolith combination where every ParseServer has it own bundeled ParseDashboard as middelware in the same Nest.js app.

Both approaches have pros and cons, with same process you could share master key from the same env. var. process.env.PARSE_SERVER_MASTER_KEY but when ParseDashboard is not the part of the same app, node_modules and memory footprint are smaller, but master key should be set on both places and one more service is here to maintain.

@gnu-lorien
Copy link

gnu-lorien commented May 30, 2021

I recently upgraded parse-dashboard and found myself into exactly this situation. Using npm resolutions just causes the graphql module to not be found for parse-server.

@mtrezza

This comment has been minimized.

@gnu-lorien
Copy link

I tried using the version of parse-dashboard which has updated dependencies here: #1677

That pushed graphql to 15.5.0. parse-server is on 15.4.0. It didn't work either. Using resolutions had the same problem where now parse-server can't find graphql at all.

@keaton-codes-tech
Copy link

keaton-codes-tech commented Jun 2, 2021

I am having the same problem as gnu-lorien describes.
inside package.json
"dependencies": {
"express": "^4.17.1",
"parse-server": "^4.5.0",
"parse-dashboard": "^2.1.0"
}

on npm install
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: [email protected]
npm WARN node_modules/graphql
npm WARN graphql@"14.6.0" from [email protected]
npm WARN node_modules/parse-dashboard
npm WARN parse-dashboard@"^2.1.0" from the root project
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer graphql@"^0.10.0 || ^0.11.0 || ^0.12.0" from [email protected]
npm WARN node_modules/codemirror-graphql
npm WARN codemirror-graphql@"github:timsuchanek/codemirror-graphql#details-fix" from [email protected]
npm WARN node_modules/parse-dashboard
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: [email protected]
npm WARN node_modules/graphql
npm WARN peer graphql@"^0.10.0 || ^0.11.0 || ^0.12.0" from [email protected]
npm WARN node_modules/codemirror-graphql
npm WARN codemirror-graphql@"github:timsuchanek/codemirror-graphql#details-fix" from [email protected]
npm WARN node_modules/parse-dashboard
npm WARN 1 more (graphql-language-service-interface)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer graphql@">= v14.5.0 <= 15.5.0" from [email protected]
npm WARN node_modules/graphql-language-service-parser
npm WARN graphql-language-service-parser@"^1.0.18" from [email protected]
npm WARN node_modules/codemirror-graphql
npm WARN 1 more (graphql-language-service-interface)
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: [email protected]
npm WARN node_modules/graphql-playground-react/node_modules/react
npm WARN react@"^16.3.1" from [email protected]
npm WARN node_modules/graphql-playground-react
npm WARN graphql-playground-react@"1.7.20" from [email protected]
npm WARN node_modules/parse-dashboard
npm WARN 1 more (graphiql)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react@">=15.5 <16" from [email protected]
npm WARN node_modules/graphql-playground-react/node_modules/react-codemirror
npm WARN react-codemirror@"^1.0.0" from [email protected]
npm WARN node_modules/graphql-playground-react
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: [email protected]
npm WARN node_modules/graphql-playground-react/node_modules/react-dom
npm WARN react-dom@"^16.3.1" from [email protected]
npm WARN node_modules/graphql-playground-react
npm WARN graphql-playground-react@"1.7.20" from [email protected]
npm WARN node_modules/parse-dashboard
npm WARN 1 more (graphiql)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react-dom@">=15.5 <16" from [email protected]
npm WARN node_modules/graphql-playground-react/node_modules/react-codemirror
npm WARN react-codemirror@"^1.0.0" from [email protected]
npm WARN node_modules/graphql-playground-react
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: [email protected]
npm WARN node_modules/parse-dashboard/node_modules/graphql
npm WARN graphql@"14.6.0" from [email protected]
npm WARN node_modules/parse-dashboard
npm WARN parse-dashboard@"^2.1.0" from the root project
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer graphql@"^0.10.0 || ^0.11.0 || ^0.12.0" from [email protected]
npm WARN node_modules/parse-dashboard/node_modules/codemirror-graphql
npm WARN codemirror-graphql@"github:timsuchanek/codemirror-graphql#details-fix" from [email protected]
npm WARN node_modules/parse-dashboard
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: [email protected]
npm ERR! node_modules/graphql
npm ERR! peer graphql@">= v14.5.0 <= 15.5.0" from [email protected]
npm ERR! node_modules/graphql-language-service-parser
npm ERR! graphql-language-service-parser@"^1.0.18" from [email protected]
npm ERR! node_modules/codemirror-graphql
npm ERR! codemirror-graphql@"github:timsuchanek/codemirror-graphql#details-fix" from [email protected]
npm ERR! node_modules/parse-dashboard
npm ERR! parse-dashboard@"^2.1.0" from the root project
npm ERR! graphql-language-service-parser@"^1.2.2" from [email protected]
npm ERR! node_modules/codemirror-graphql/node_modules/graphql-language-service-interface
npm ERR! graphql-language-service-interface@"^1.0.18" from [email protected]
npm ERR! node_modules/codemirror-graphql
npm ERR! codemirror-graphql@"github:timsuchanek/codemirror-graphql#details-fix" from [email protected]
npm ERR! node_modules/parse-dashboard
npm ERR! peer graphql@">= v14.5.0 <= 15.5.0" from [email protected]
npm ERR! node_modules/graphql-language-service-parser/node_modules/graphql-language-service-types
npm ERR! graphql-language-service-types@"^1.8.0" from [email protected]
npm ERR! node_modules/graphql-language-service-parser
npm ERR! graphql-language-service-parser@"^1.0.18" from [email protected]
npm ERR! node_modules/codemirror-graphql
npm ERR! codemirror-graphql@"github:timsuchanek/codemirror-graphql#details-fix" from [email protected]
npm ERR! node_modules/parse-dashboard
npm ERR! 1 more (graphql-language-service-interface)
npm ERR! 3 more (apollo-link, apollo-link-http, subscriptions-transport-ws)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer graphql@"^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0-b || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0" from [email protected]
npm ERR! node_modules/graphql-relay
npm ERR! graphql-relay@"0.6.0" from [email protected]
npm ERR! node_modules/parse-server
npm ERR! parse-server@"^4.5.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

@mtrezza
Copy link
Member

mtrezza commented Jun 2, 2021

Please see parse-community/parse-server#7410 (comment).

Generally, not every version of Parse Dashboard is compatible with every version of Parse Server. I think we haven't really considered both running in the same package and preventing peer dependency conflicts. That's a topic to keep in mind (even though it should self-resolve with npm 7) and we should probably provide a compatibility table.

The current workaround is probably to launch Parse Server and Parse Dashboard in separate node processes.

The fix is probably to identify the difference in dependency versions and submit a PR to bring both onto the same version.

@nex-derek
Copy link

Actually the main issue should be parse-server depends on graphql-relay 0.6.0 and both parse-server & graphql-relay depends on different version of graphql. It can be fix by updating parse-server to depend on graphql-relay 0.7.0.

@mtrezza
Copy link
Member

mtrezza commented Jun 2, 2021

Sounds even easier to fix, but why is this issue then open in the dashboard repo and not in the server repo? Or are you referring to a graphql-relay dependency in the dashboard?

@contentsr
Copy link

Same problem facing, I am running both, Parse Dashboard and Parse Server, in the same instance. Please fix it ASAP.

@mtrezza mtrezza added state:wont-fix Won’t be fixed with a clearly stated reason needs investigation and removed state:wont-fix Won’t be fixed with a clearly stated reason labels Jun 21, 2021
@mtrezza
Copy link
Member

mtrezza commented Sep 24, 2021

#1807 should fix this issue. It contains several changes:

@dblythy
Copy link
Member

dblythy commented Oct 1, 2021

I think we can close this @mtrezza as GraphQL has been bumped for the dashboard?

@mtrezza
Copy link
Member

mtrezza commented Oct 1, 2021

I think so too. Closing via #1807.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants