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

SockJS-Client version mismatch #1268

Closed
holloway opened this issue Dec 14, 2016 · 5 comments
Closed

SockJS-Client version mismatch #1268

holloway opened this issue Dec 14, 2016 · 5 comments
Milestone

Comments

@holloway
Copy link
Contributor

If you start the dev server and browse to,

/sockjs-node/iframe.html

You'll see the fallback for when a browser can't establish a websocket connection. It references a CDN version of SockJS-Client 1.0.1

<script src="https://cdn.jsdelivr.net/sockjs/1.0.1/sockjs.min.js"></script>

But the chosen SockJS-Client version elsewhere in react-dev-tools is 1.0.3 so it fails with this error,

sockjs.min.js:2 Uncaught Error: Incompatibile SockJS! Main site uses: "1.0.3", the iframe: "1.0.1".s

SockJS-Client 1.0.3 was chosen at https://github.com/facebookincubator/create-react-app/blob/master/packages/react-dev-utils/package.json#L31

If you disable websockets in your browser, or have a proxy that doesn't handle websockets (like I do), you can reproduce this error.

You could fix this by downgrading the package.json to version 1.0.1, or by using a fork of sockjs-node that matches the version you want by applying this patch holloway/sockjs-node@6c1a7b6

Incidentally the current version of SockJS-Client is 1.1.1.

@gaearon
Copy link
Contributor

gaearon commented Dec 14, 2016

I’m a bit confused, why do you

browse to /sockjs-node/iframe.html

?

This is a bit hidden so I don’t quite understand your use case.

@holloway
Copy link
Contributor Author

holloway commented Dec 14, 2016

Sorry I was unclear. Browsing to the iframe.html is just a way of seeing the version mismatch for yourself (if websockets fail SockJS-Client attaches an iframe pointing at that url, but as websockets probably work for you then browsing to that url and viewing source will let you see the 1.0.1 vs 1.0.3 version mismatch).

You can reproduce the error yourself by disabling websockets in your browser, and then on the very first page that appears after running npm start you'll get this error:

sockjs.min.js:2 Uncaught Error: Incompatibile SockJS! Main site uses: "1.0.3", the iframe: "1.0.1".s

My use case is trying to integrate create-react-app with a CMS. During development I'm proxying the dev server from the CMS, but the CMS platform can't proxy websockets and I get this error which prevents me getting SockJS features such as reloads.

@gaearon
Copy link
Contributor

gaearon commented Dec 14, 2016

Could you submit a fix please if you have one in mind?

@kesuskim
Copy link

I experienced the same problem while I set project myself, and I found out downgrading webpack-dev-server will do the job. In my case, I used webpack 1.12.9, webpack-dev-server 1.12.0. Previously I just use latest (both).

@gaearon
Copy link
Contributor

gaearon commented Feb 11, 2017

This was presumably fixed by #1274, released in 0.9.0. Please verify and let us know!

@gaearon gaearon closed this as completed Feb 11, 2017
@gaearon gaearon added this to the 0.9.0 milestone Feb 11, 2017
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants