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

Using Vite 3.0.0-beta.0 does not work #14021

Closed
Artur- opened this issue Jun 22, 2022 · 4 comments · Fixed by #14040
Closed

Using Vite 3.0.0-beta.0 does not work #14021

Artur- opened this issue Jun 22, 2022 · 4 comments · Fixed by #14040

Comments

@Artur-
Copy link
Member

Artur- commented Jun 22, 2022

Description of the bug

If you upgrade vite to 3.0.0-beta.0 the applications starts but all connections to the Vite server are refused.

java.net.ConnectException: Connection refused
	java.base/sun.nio.ch.Net.pollConnect(Native Method)
	java.base/sun.nio.ch.Net.pollConnectNow(Net.java:672)
	java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:549)
	java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597)
	java.base/java.net.Socket.connect(Socket.java:633)
	java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:178)
	java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:498)
	java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:603)
	java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:246)
	java.base/sun.net.www.http.HttpClient.New(HttpClient.java:351)
	java.base/sun.net.www.http.HttpClient.New(HttpClient.java:373)
	java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1309)
	java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1242)
	java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1128)
	java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1057)
	java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1665)
	java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1589)
	com.vaadin.flow.server.frontend.FrontendUtils.getFileFromDevModeHandler(FrontendUtils.java:665)
	com.vaadin.flow.server.frontend.FrontendUtils.getFileContent(FrontendUtils.java:528)
	com.vaadin.flow.server.frontend.FrontendUtils.getIndexHtmlContent(FrontendUtils.java:492)
	com.vaadin.flow.server.communication.IndexHtmlRequestHandler.getIndexHtmlDocument(IndexHtmlRequestHandler.java:304)
	com.vaadin.flow.server.communication.IndexHtmlRequestHandler.synchronizedHandleRequest(IndexHtmlRequestHandler.java:83)
	com.vaadin.flow.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
	com.vaadin.flow.server.VaadinService.handleRequest(VaadinService.java:1564)
	com.vaadin.flow.server.VaadinServlet.service(VaadinServlet.java:299)
	com.vaadin.flow.spring.SpringServlet.service(SpringServlet.java:109)

Additionally the application goes into an infinite Spring Boot restart loop and seemingly more and more output trackers are started:

2022-06-22 10:48:19.274  INFO 584 --- [  restartedMain] com.example.application.Application      : Started Application in 0.272 seconds (JVM running for 85.327)
2022-06-22 10:48:19.274  INFO 584 --- [  restartedMain] .ConditionEvaluationDeltaLoggingListener : Condition evaluation unchanged
2022-06-22 10:48:19.560  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.560  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.562  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.562  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.562  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.562  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.570  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.570  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.572  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.572  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.585  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.585  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.586  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.586  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.604  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.604  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.638  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.638  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.641  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.641  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.655  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.655  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.661  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.661  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.672  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.672  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.686  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.686  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.694  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.694  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.712  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.712  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.717  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.717  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.762  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.762  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.762  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.762  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.766  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.766  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.766  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.766  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.769  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.769  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.775  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.775  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.779  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.779  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.797  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.797  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.798  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.799  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.810  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.810  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.812  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.812  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.833  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.833  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.
2022-06-22 10:48:19.851  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:19.851  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found 0 errors. Watching for file changes.

------------------ Starting Frontend compilation. ------------------
2022-06-22 10:48:20.201  INFO 584 --- [onPool-worker-1] c.v.b.devserver.AbstractDevServerRunner  : Running Vite to compile frontend resources. This may take a moment, please stand by...
2022-06-22 10:48:20.515  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Searching themes folder '/.../testvite3/frontend/themes' for theme 'testvite3'
2022-06-22 10:48:20.515  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : no assets to handle no static assets were copied
2022-06-22 10:48:20.516  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : Found theme files from '/.../testvite3/frontend/themes'
2022-06-22 10:48:20.643  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
2022-06-22 10:48:20.858  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:20.858  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :   VITE v3.0.0-beta.0  ready in 632 ms

----------------- Frontend compiled successfully. -----------------

2022-06-22 10:48:20.858  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-06-22 10:48:20.858  INFO 584 --- [onPool-worker-1] c.v.b.devserver.AbstractDevServerRunner  : Started Vite. Time: 1599ms
2022-06-22 10:48:20.858  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :   ➜  Local:   http://localhost:61129/VAADIN/
2022-06-22 10:48:20.858  INFO 584 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :   ➜  Network: use --host to expose
 _               _           _  _          _____ 
| |_   ___  ___ | |_ __   __(_)| |_   ___ |___ / 
| __| / _ \/ __|| __|\ \ / /| || __| / _ \  |_ \ 
| |_ |  __/\__ \| |_  \ V / | || |_ |  __/ ___) |
 \__| \___||___/ \__|  \_/  |_| \__| \___||____/ 
                                                 

2022-06-22 10:48:21.736  INFO 584 --- [  restartedMain] com.example.application.Application      : Starting Application using Java 17.0.1 on ....local with PID 584 (/.../testvite3/target/classes started by artur in /.../testvite3)
2022-06-22 10:48:21.736  INFO 584 --- [  restartedMain] com.example.application.Application      : No active profile set, falling back to 1 default profile: "default"
2022-06-22 10:48:21.801  INFO 584 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 2000 (http)

the restart loop comes from

2022-06-22 10:49:32.545 DEBUG 1982 --- [   File Watcher] o.s.boot.devtools.restart.Restarter      : Application restart required due to the following changes: [/.../testvite3/target/classes [/.../testvite3/target/classes/META-INF/VAADIN/webapp/sw.js.map (MODIFY), /.../testvite3/target/classes/META-INF/VAADIN/webapp/sw.js (MODIFY)]]

Expected behavior

It should just work

Minimal reproducible example

vaadin init testvite3
cd testvite3
npm i vite@3.0.0-beta.0
mvn

Versions

  • Vaadin / Flow version: 23.1.1
  • Java version: 17.0.1
  • OS version: macOS
@Artur-
Copy link
Member Author

Artur- commented Jun 22, 2022

The restart on startup seems to be an issue already with Vite 2: #14022

@Artur-
Copy link
Member Author

Artur- commented Jun 23, 2022

Caused by vitejs/vite#8543 which makes the Vite server no longer respond on 127.0.0.1, only on ::1 i.e. IPv6.

If we add

server: {
    host: '127.0.0.1',
   }

to the configuration, it will work as before

Artur- added a commit that referenced this issue Jun 23, 2022
Use 127.0.0.1 both for the Vite server and when connecting to it to ensure it works

Fixes #14021
Artur- added a commit that referenced this issue Jun 27, 2022
Use 127.0.0.1 both for the Vite server and when connecting to it to ensure it works

Fixes #14021
OLD Vaadin Flow bugs & maintenance (Vaadin 10+) automation moved this from Needs triage to Closed Jun 27, 2022
taefi pushed a commit that referenced this issue Jun 27, 2022
Use 127.0.0.1 both for the Vite server and when connecting to it to ensure it works

Fixes #14021
vaadin-bot pushed a commit that referenced this issue Jun 27, 2022
Use 127.0.0.1 both for the Vite server and when connecting to it to ensure it works

Fixes #14021
vaadin-bot pushed a commit that referenced this issue Jun 27, 2022
Use 127.0.0.1 both for the Vite server and when connecting to it to ensure it works

Fixes #14021
vaadin-bot pushed a commit that referenced this issue Jun 27, 2022
Use 127.0.0.1 both for the Vite server and when connecting to it to ensure it works

Fixes #14021
mcollovati pushed a commit that referenced this issue Jun 27, 2022
Use 127.0.0.1 both for the Vite server and when connecting to it to ensure it works

Fixes #14021

Co-authored-by: Artur <artur@vaadin.com>
mcollovati pushed a commit that referenced this issue Jun 27, 2022
Use 127.0.0.1 both for the Vite server and when connecting to it to ensure it works

Fixes #14021

Co-authored-by: Artur <artur@vaadin.com>
Artur- pushed a commit that referenced this issue Jun 27, 2022
Use 127.0.0.1 both for the Vite server and when connecting to it to ensure it works

Fixes #14021
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 22.0.18.

@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 23.1.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants