Description
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.