Skip to content

GraphQL versions mismatch between latest ParseServer and latest ParseDashboard #1656

Closed

Description

@stepanic

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 graphql@14.6.0 but the latest ParseServer has graphql@15.4.0 which is not compatibile.

Also setting the npm resolutions in package.json to use graphql@15.4.0 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.

Activity

  1. ivegner commented on Mar 17, 2021

    @ivegner

    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.

  2. stepanic commented on Mar 18, 2021

    @stepanic
    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.

  3. gnu-lorien commented on May 30, 2021

    @gnu-lorien

    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.

  4. mtrezza commented on May 30, 2021

    @mtrezza
  5. gnu-lorien commented on May 30, 2021

    @gnu-lorien

    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.

  6. keaton-codes-tech commented on Jun 2, 2021

    @keaton-codes-tech

    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: graphql@14.6.0
    npm WARN node_modules/graphql
    npm WARN graphql@"14.6.0" from parse-dashboard@2.1.0
    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 codemirror-graphql@0.6.12
    npm WARN node_modules/codemirror-graphql
    npm WARN codemirror-graphql@"github:timsuchanek/codemirror-graphql#details-fix" from parse-dashboard@2.1.0
    npm WARN node_modules/parse-dashboard
    npm WARN ERESOLVE overriding peer dependency
    npm WARN Found: graphql@0.12.3
    npm WARN node_modules/graphql
    npm WARN peer graphql@"^0.10.0 || ^0.11.0 || ^0.12.0" from codemirror-graphql@0.6.12
    npm WARN node_modules/codemirror-graphql
    npm WARN codemirror-graphql@"github:timsuchanek/codemirror-graphql#details-fix" from parse-dashboard@2.1.0
    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 graphql-language-service-parser@1.9.2
    npm WARN node_modules/graphql-language-service-parser
    npm WARN graphql-language-service-parser@"^1.0.18" from codemirror-graphql@0.6.12
    npm WARN node_modules/codemirror-graphql
    npm WARN 1 more (graphql-language-service-interface)
    npm WARN ERESOLVE overriding peer dependency
    npm WARN Found: react@16.14.0
    npm WARN node_modules/graphql-playground-react/node_modules/react
    npm WARN react@"^16.3.1" from graphql-playground-react@1.7.20
    npm WARN node_modules/graphql-playground-react
    npm WARN graphql-playground-react@"1.7.20" from parse-dashboard@2.1.0
    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 react-codemirror@1.0.0
    npm WARN node_modules/graphql-playground-react/node_modules/react-codemirror
    npm WARN react-codemirror@"^1.0.0" from graphql-playground-react@1.7.20
    npm WARN node_modules/graphql-playground-react
    npm WARN ERESOLVE overriding peer dependency
    npm WARN Found: react-dom@16.14.0
    npm WARN node_modules/graphql-playground-react/node_modules/react-dom
    npm WARN react-dom@"^16.3.1" from graphql-playground-react@1.7.20
    npm WARN node_modules/graphql-playground-react
    npm WARN graphql-playground-react@"1.7.20" from parse-dashboard@2.1.0
    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 react-codemirror@1.0.0
    npm WARN node_modules/graphql-playground-react/node_modules/react-codemirror
    npm WARN react-codemirror@"^1.0.0" from graphql-playground-react@1.7.20
    npm WARN node_modules/graphql-playground-react
    npm WARN ERESOLVE overriding peer dependency
    npm WARN Found: graphql@14.6.0
    npm WARN node_modules/parse-dashboard/node_modules/graphql
    npm WARN graphql@"14.6.0" from parse-dashboard@2.1.0
    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 codemirror-graphql@0.6.12
    npm WARN node_modules/parse-dashboard/node_modules/codemirror-graphql
    npm WARN codemirror-graphql@"github:timsuchanek/codemirror-graphql#details-fix" from parse-dashboard@2.1.0
    npm WARN node_modules/parse-dashboard
    npm ERR! code ERESOLVE
    npm ERR! ERESOLVE unable to resolve dependency tree
    npm ERR!
    npm ERR! Found: graphql@15.5.0
    npm ERR! node_modules/graphql
    npm ERR! peer graphql@">= v14.5.0 <= 15.5.0" from graphql-language-service-parser@1.9.2
    npm ERR! node_modules/graphql-language-service-parser
    npm ERR! graphql-language-service-parser@"^1.0.18" from codemirror-graphql@0.6.12
    npm ERR! node_modules/codemirror-graphql
    npm ERR! codemirror-graphql@"github:timsuchanek/codemirror-graphql#details-fix" from parse-dashboard@2.1.0
    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 graphql-language-service-interface@1.3.2
    npm ERR! node_modules/codemirror-graphql/node_modules/graphql-language-service-interface
    npm ERR! graphql-language-service-interface@"^1.0.18" from codemirror-graphql@0.6.12
    npm ERR! node_modules/codemirror-graphql
    npm ERR! codemirror-graphql@"github:timsuchanek/codemirror-graphql#details-fix" from parse-dashboard@2.1.0
    npm ERR! node_modules/parse-dashboard
    npm ERR! peer graphql@">= v14.5.0 <= 15.5.0" from graphql-language-service-types@1.8.2
    npm ERR! node_modules/graphql-language-service-parser/node_modules/graphql-language-service-types
    npm ERR! graphql-language-service-types@"^1.8.0" from graphql-language-service-parser@1.9.2
    npm ERR! node_modules/graphql-language-service-parser
    npm ERR! graphql-language-service-parser@"^1.0.18" from codemirror-graphql@0.6.12
    npm ERR! node_modules/codemirror-graphql
    npm ERR! codemirror-graphql@"github:timsuchanek/codemirror-graphql#details-fix" from parse-dashboard@2.1.0
    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 graphql-relay@0.6.0
    npm ERR! node_modules/graphql-relay
    npm ERR! graphql-relay@"0.6.0" from parse-server@4.5.0
    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.

  7. mtrezza commented on Jun 2, 2021

    @mtrezza
    Member

    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.

  8. nex-derek commented on Jun 2, 2021

    @nex-derek

    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.

  9. mtrezza commented on Jun 2, 2021

    @mtrezza
    Member

    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?

  10. contentsr commented on Jun 17, 2021

    @contentsr

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

  11. added
    state:wont-fixWon’t be fixed with a clearly stated reason
    and removed
    state:wont-fixWon’t be fixed with a clearly stated reason
    on Jun 21, 2021
  12. mtrezza commented on Sep 24, 2021

    @mtrezza
    Member

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

  13. dblythy commented on Oct 1, 2021

    @dblythy
    Member

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

  14. mtrezza commented on Oct 1, 2021

    @mtrezza
    Member

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions