Apollo-server: GraphiQL - Uncaught ReferenceError: ReactDOM is not defined

Created on 12 Aug 2017  Â·  12Comments  Â·  Source: apollographql/apollo-server

image

"apollo-server-express": "^1.1.0",
"body-parser": "^1.17.2",
"express": "^4.15.4",
"graphql": "^0.10.5",
"graphql-tools": "^1.1.0"

my code:

import * as express from 'express';
import * as bodyParser from 'body-parser';
import {graphqlExpress,graphiqlExpress} from 'apollo-server-express';
import schema from './schema';

const app = express();
app.use('/graphql',bodyParser.json(),graphqlExpress({schema}));

app.use('/graphiql',graphiqlExpress({
    endpointURL:'/graphql'
}));

const PORT = 3000;
app.listen(PORT,()=>{
    console.log(`running on port ${PORT}`);
});

Most helpful comment

same issue, agree with @duvet86

workaround:
change [email protected]/dist/react-dom.min.js to [email protected]/dist/react-dom.min.js in
node_modules/apollo-server-module-graphiql/dist/renderGraphiQL.js and restart server.

All 12 comments

Same here.
The issue happens because of react-dom stored in https://unpkg.com/[email protected]/dist/react-dom.min.js
There's a ret at the end of the file.
Apollo graphiql pulls react-dom from there.
Have a look at apollo-server-module-graphiql, renderGraphiQL.js

problem is with latest chrome version (60.0.3112.90 (Official Build) (64-bit)). something with service workers.
edge works fine

Does graphiql use a service worker?
The issue is on the cdn. Open it, scroll to the end, there's a "ret" breaking the script.

works fine on edge browser

On Sun, Aug 13, 2017, 03:28 Luca notifications@github.com wrote:

Does graphiql use a service worker?
The issue is on the cdn. Open it, scroll to the end, there's a "ret"
breaking the script.

—
You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub
https://github.com/apollographql/apollo-server/issues/502#issuecomment-322014127,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQ-rrGsZ-3d0lFFnN0g2PRONzcA6qQRXks5sXkM6gaJpZM4O1MHD
.

same issue, agree with @duvet86

workaround:
change [email protected]/dist/react-dom.min.js to [email protected]/dist/react-dom.min.js in
node_modules/apollo-server-module-graphiql/dist/renderGraphiQL.js and restart server.

same issue, agree with @duvet86

workaround:
change [email protected]/dist/react-dom.min.js to [email protected]/dist/react-dom.min.js in
node_modules/apollo-server-module-graphiql/dist/renderGraphiQL.js and restart server.

@ferrugemjs didnt work for me

maybe the 3rd party packages should be stored within the package itself

Yeah that's what #376 is all about

I think this was an issue with the CDN that's resolved now? Either way #376 is the right solution, looking forward to a PR there!

I am still having this issue, unfortunately :( Looking forward to the #376 solution :)

Was having the same issue on localhost and found that it was related to the Fair AdBlocker Chrome extension. Whitelisting localhost solved the issue for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jminz picture jminz  Â·  3Comments

deathg0d picture deathg0d  Â·  3Comments

nevyn-lookback picture nevyn-lookback  Â·  3Comments

mathroc picture mathroc  Â·  3Comments

stevezau picture stevezau  Â·  3Comments