Wulf / create-rust-app

Set up a modern rust+react web app by running one command.

Home Page:https://create-rust-app.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Endless ""GET /__vite_ping HTTP/1.1" 404

liusen-adalab opened this issue · comments

Reproduction

Run command as tutorial video in readme: https://github.com/Wulf/create-rust-app/blob/main/docs/create-rust-app-v2.mp4

Logs

[backend] [2022-10-12T01:47:43Z INFO  actix_web::middleware::logger] 192.168.124.1 "POST /api/auth/refresh HTTP/1.1" 401 49 "http://192.168.124.111:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36" 0.002163
[backend] ASSET_FILE /src/images/plus.svg => ./frontend/src/images/plus.svg
[backend] ASSET_FILE /src/images/logo.svg => ./frontend/src/images/logo.svg
[backend] [2022-10-12T01:47:43Z INFO  actix_web::middleware::logger] 192.168.124.1 "GET /src/images/plus.svg HTTP/1.1" 304 0 "http://192.168.124.111:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36" 0.000662
[backend] [2022-10-12T01:47:43Z INFO  actix_web::middleware::logger] 192.168.124.1 "GET /src/images/logo.svg HTTP/1.1" 304 0 "http://192.168.124.111:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36" 0.000610
[backend] [2022-10-12T01:47:43Z INFO  actix_web::middleware::logger] 192.168.124.1 "GET /api/development/health HTTP/1.1" 200 41 "http://192.168.124.111:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36" 0.000834
[backend] [2022-10-12T01:47:43Z INFO  actix_web::middleware::logger] 192.168.124.1 "GET /api/development/db/needs-migration HTTP/1.1" 200 25 "http://192.168.124.111:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36" 0.002727
[backend] PUBLIC_FILE /pwa.json => ./frontend/public/pwa.json
[backend] [2022-10-12T01:47:43Z INFO  actix_web::middleware::logger] 192.168.124.1 "GET /pwa.json HTTP/1.1" 304 0 "http://192.168.124.111:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36" 0.000776
[backend] The vite dev server seems to be down...
[backend] [2022-10-12T01:47:45Z INFO  actix_web::middleware::logger] 192.168.124.1 "GET /__vite_ping HTTP/1.1" 404 20 "http://192.168.124.111:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36" 0.000735
[backend] The vite dev server seems to be down...
[backend] [2022-10-12T01:47:46Z INFO  actix_web::middleware::logger] 192.168.124.1 "GET /__vite_ping HTTP/1.1" 404 20 "http://192.168.124.111:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36" 0.000742
[backend] The vite dev server seems to be down...

question

It seems that "vite_ping" is fetched by vite plugin from "localhost:3000",which will derectly go to backend default endpoints. It seems like a bug. Should create-rust-app put index.html in frontend and query "localhost:21012" in browser?

async function waitForSuccessfulPing(ms = 1000) {
  // eslint-disable-next-line no-constant-condition
  while (true) {
    try {
      const pingResponse = await fetch(`${base}__vite_ping`)

      // success - 2xx status code
      if (pingResponse.ok) break
      // failure - non-2xx status code
      else throw new Error()
    } catch (e) {
      // wait ms before attempting to ping again
      await new Promise((resolve) => setTimeout(resolve, ms))
    }
  }
}
commented

Fixed in 9.0.0 :)

🚀

Thanks again for reporting this and feel free to reopen as needed!