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

"Not found: /" error in dev mode when you have no root route #7218

Closed
johnnysprinkles opened this issue Oct 10, 2022 · 1 comment · Fixed by #9933
Closed

"Not found: /" error in dev mode when you have no root route #7218

johnnysprinkles opened this issue Oct 10, 2022 · 1 comment · Fixed by #9933
Labels
p3-edge-case SvelteKit cannot be used in an uncommon way
Milestone

Comments

@johnnysprinkles
Copy link
Contributor

Describe the bug

This is pretty minor, but if you're using adapter-static and building a subtree that you'll be shoehorning into some other legacy app, you might not need the root route /. If you don't have one, you get this error every time you restart the dev server and you have a browser window open:

jpsimons@Johns-iMac sveltekit_no_root_path % npm run dev

> [email protected] dev
> vite dev


  VITE v3.1.7  ready in 242 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
Not found: /
Error: Not found: /
    at resolve (file:///Users/jpsimons/dev/sveltekit_no_root_path/node_modules/@sveltejs/kit/src/runtime/server/index.js:259:13)
    at resolve (file:///Users/jpsimons/dev/sveltekit_no_root_path/node_modules/@sveltejs/kit/src/runtime/server/index.js:290:5)
    at Object.handle (file:///Users/jpsimons/dev/sveltekit_no_root_path/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:336:66)
    at respond (file:///Users/jpsimons/dev/sveltekit_no_root_path/node_modules/@sveltejs/kit/src/runtime/server/index.js:287:40)
    at async file:///Users/jpsimons/dev/sveltekit_no_root_path/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:406:22
^C

Not sure why anything would be trying to load /, my browser is sitting on the route that exists, i.e. http://localhost:5173/blah

Reproduction

Repro example at https://github.com/johnnysprinkles/sveltekit_no_root_path/commits/main It's just the stock skeleton app with the only route moved down a folder.

Logs

No response

System Info

System:
    OS: macOS 12.2.1
    CPU: (8) arm64 Apple M1
    Memory: 78.38 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 18.10.0 - ~/.nvm/versions/node/v18.10.0/bin/node
    npm: 8.19.2 - ~/.nvm/versions/node/v18.10.0/bin/npm
  Browsers:
    Firefox: 105.0.1
    Safari: 15.3
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.81
    @sveltejs/kit: next => 1.0.0-next.512
    svelte: ^3.44.0 => 3.51.0
    vite: ^3.1.0 => 3.1.7

Severity

annoyance

Additional Information

No response

@dummdidumm dummdidumm added the p3-edge-case SvelteKit cannot be used in an uncommon way label Oct 11, 2022
@dummdidumm dummdidumm added this to the whenever milestone Oct 11, 2022
@gtm-nayan
Copy link
Contributor

gtm-nayan commented May 4, 2023

This seems to be because of the ping requests sent by vite when you close the server after loading a page.

Although, I don't see anything special in those requests for us to identify them currently.

cc @bluwy, would a header like X-Vite-Ping: true be possible to add upstream?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-edge-case SvelteKit cannot be used in an uncommon way
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants