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

iframe errors #105

Closed
glekner opened this issue Jun 1, 2020 · 15 comments · Fixed by #133
Closed

iframe errors #105

glekner opened this issue Jun 1, 2020 · 15 comments · Fixed by #133

Comments

@glekner
Copy link

glekner commented Jun 1, 2020

image

These errors started after adding react-refresh and babel (typescript). any idea what causes this?

@pmmmwh
Copy link
Owner

pmmmwh commented Jun 4, 2020

This is due to SockJS, used in webpack-dev-server.

If you are not using WDS, you should probably configure the socket integration as stated in the README.

If you're using WDS, this issue is likely happening because a proper WebSocket implementation was not detected by SockJS in the browser, and thus it is falling back to using an iframe-based Cross Origin solution - which will get blocked by X-Frame-Options: deny obviously.

You can work-around this by using the native ws integration provided by WDS, but it still won't work in browsers without socket implementations.

@pmmmwh
Copy link
Owner

pmmmwh commented Jun 4, 2020

I'll be closing this because this is unrelated to the plugin.

@pmmmwh pmmmwh closed this as completed Jun 4, 2020
@glekner
Copy link
Author

glekner commented Jun 28, 2020

hey @pmmmwh
switching transportMode to ws indeed fixes the issue.
could this break something else in the code? the app seems to run fine, browser support is also pretty decent if i'm not wrong?

@pmmmwh
Copy link
Owner

pmmmwh commented Jun 28, 2020

could this break something else in the code?

No. If it does please redirect your issue to the webpack-dev-server repo.

browser support is also pretty decent if i'm not wrong?

As shown in caniuse, you're covered 97.57% of the time.

@glekner
Copy link
Author

glekner commented Jul 2, 2020

nice, I do get a warning of still using SockJS even though I cant find any reference to the pattern sockjs || sock-js in the code?

WebSocket connection to 'ws://localhost:9000/sockjs-node' failed: Error during WebSocket handshake: Unexpected response code: 200

@pmmmwh
Copy link
Owner

pmmmwh commented Jul 2, 2020

nice, I do get a warning of still using SockJS even though I cant find any reference to the pattern sockjs || sock-js in the code?

WebSocket connection to 'ws://localhost:9000/sockjs-node' failed: Error during WebSocket handshake: Unexpected response code: 200

If you use a custom socket path for WDS - you will have to tell the plugin. sockjs-node is the default fallback path hard-coded in WDS and in the plugin for the WDS integration.

@glekner
Copy link
Author

glekner commented Jul 2, 2020

Thanks, hijacking this issue for another question
Is it possible to not use:?

Note 1: If you use webpack.config.ts, please also install type-fest as a peer dependency.

I'm not getting any type errors without it.

@pmmmwh
Copy link
Owner

pmmmwh commented Jul 2, 2020

I'm not getting any type errors without it.

In theory, this shouldn't be the case - you can take a look at the files within types and clearly we have dependency on type-fest for error overlay options at least - maybe if you don't use these options tsc is smart enough to not warn ...

@glekner
Copy link
Author

glekner commented Jul 6, 2020

If you use a custom socket path for WDS - you will have to tell the plugin. sockjs-node is the default fallback path hard-coded in WDS and in the plugin for the WDS integration.

@pmmmwh
I'm using ws instead of the default sock-js as you advised.
Do you know what path/port do I need to change in the plugin options?

@pmmmwh
Copy link
Owner

pmmmwh commented Jul 6, 2020

Do you know what path/port do I need to change in the plugin options?

Please post your dev server config here 😊

@glekner
Copy link
Author

glekner commented Jul 6, 2020

I fixed it :)
Because were running a bridge proxy just needed to add the webpack port to the plugin config.
It didn't work on 0.4.0.beta6 ! I still got the error for some reason.
I downgraded to 0.3.3

          new ReactRefreshWebpackPlugin({
            overlay: {
              sockPort: WDS_PORT,
            },
          }),

@pmmmwh
Copy link
Owner

pmmmwh commented Jul 6, 2020

I fixed it :)
Because were running a bridge proxy just needed to add the webpack port to the plugin config.
It didn't work on 0.4.0.beta6 ! I still got the error for some reason.

I will ... Erm ... Have to take a look at it then I guess 😂

@pmmmwh
Copy link
Owner

pmmmwh commented Jul 6, 2020

Error addressed in #133.

@glekner
Copy link
Author

glekner commented Jul 14, 2020

@pmmmwh is there a way to disable the error overlay? without sacrificing the new sockPort I just added to the overlay object?

@pmmmwh
Copy link
Owner

pmmmwh commented Jul 14, 2020

@pmmmwh is there a way to disable the error overlay? without sacrificing the new sockPort I just added to the overlay object?

sockPort only affects the overlay, so if you disable it you don't need to include the flag.

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

Successfully merging a pull request may close this issue.

2 participants