Skip to content

The hotreloading does not work inside xp #327

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

Open
poi33 opened this issue Jul 8, 2022 · 3 comments
Open

The hotreloading does not work inside xp #327

poi33 opened this issue Jul 8, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@poi33
Copy link
Contributor

poi33 commented Jul 8, 2022

When you are in devmode and update a page the page is not updated.
This works if you directly access the next frontend server (default port: 3000)
So probably an issue in the next proxy?

@poi33 poi33 added the bug Something isn't working label Jul 8, 2022
@poi33
Copy link
Contributor Author

poi33 commented Jul 8, 2022

Firefox can’t establish a connection to the server at ws://localhost:8080/admin/site/preview/project/draft/sitename/_next/webpack-hmr. [main.js:36:17](http://localhost:8080/admin/site/preview/company-web/draft/sitename/_next/static/chunks/main.js?ts=1657278989876%20line%2071%20%3E%20eval)
GETws://localhost:8080/admin/site/preview/project/draft/site-name/_next/webpack-hmr

@pmi pmi self-assigned this Jul 22, 2022
@pmi
Copy link
Member

pmi commented Jul 28, 2022

When used directly at localhost:3000 nextjs client-side code creates a websocket connection at /_next/webpack-hmr.
When used in XP /_next/webpack-hmr is transformed to /admin/site/inline/next/draft/hmdb/_next/webpack-hmr.
So the websocket connection should be handled by lib-nextjs-proxy now, and tunneled to localhost:3000/_next/webpack-hmr.

The main problem here is that lib-http-client that we use in lib-nextjs-proxy is not able to handle ws requests.
So even though there is a websocket XP lib that can be used to allow ws connection from browser to lib-nextjs-proxy, we won't be able to forward it to the next server.

So we either can try to leave this url out of url rewriting and let it connect directly to nextjs server bypassing the lib-nextjs-proxy.
Or we can disable hot reload when viewed in XP completely, but keep it on when viewed directly on localhost:3000.

@poi33
Copy link
Contributor Author

poi33 commented Aug 1, 2022

I don't mind tunneling it dirrectly to localhost:3000 since this would only be done on development servers.
But it is a bit annoying for developers to have to setup different connections for ws and another one for other traffic.

I see two options here:

  1. Make a feature request to handle websockets in http-lib with our use case
  2. Bypass to localhost:3000 and consider this as an okay way to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants