question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Routing in app built by adapter-static is broken in next.266

See original GitHub issue

Describe the bug

Since upgrading to the latest version of SvelteKit a site which is compiled with the static adapter no longer works when served via Nginx.

For example routing to https://mywebsite.com works but routing to https://mywebsite.com/hello results in 404. If I were to navigate to the second link internally via an <a> the 404 would not appear. I can resolve the issue by pinning the SvelteKit version to something like 250 but being on the HEAD manifests the error.

Reproduction

  1. Build any site with static adapter and SvelteKit version 266
  2. Host output with a web server such as nginx
  3. Route to anything except index.html directly or navigate there and refresh. For example https//mysite.com/anotherpage

Logs

No response

System Info

System:
    OS: macOS 12.2
    CPU: (8) arm64 Apple M1
    Memory: 553.13 MB / 16.00 GB
    Shell: 3.3.1 - /opt/homebrew/bin/fish
  Binaries:
    Node: 17.4.0 - /opt/homebrew/bin/node
    Yarn: 1.22.10 - /opt/homebrew/bin/yarn
    npm: 8.3.1 - /opt/homebrew/bin/npm
  Browsers:
    Brave Browser: 96.1.32.115
    Chrome: 98.0.4758.80
    Firefox: 97.0
    Safari: 15.3
  npmPackages:
    @sveltejs/adapter-static: next => 1.0.0-next.28 
    @sveltejs/kit: next => 1.0.0-next.266 
    svelte: ^3.46.4 => 3.46.4

Severity

serious, but I can work around it

Additional Information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:7
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
benmccanncommented, Mar 7, 2022

Please take a look at trailingSlash: 'always': https://kit.svelte.dev/docs/configuration#trailingslash

If you set that option it will generate index.html files for you and I think it should address this issue

4reactions
frederikhorscommented, Feb 18, 2022

I’m on "@sveltejs/kit": "1.0.0-next.278" with "@sveltejs/adapter-static": "1.0.0-next.28" and with default trailingSlash (never).

I have this in (the default for new demo init project) app.html:

<link rel="icon" href="%svelte.assets%/images/icons/favicon.png" />

The issues in my case are:

  1. on each navigation SvelteKit requests the favicon
  2. until some SvelteKit version ago the request had a correct path (http://localhost:3000/images/icons/favicon.png) now instead the path is wrong based on which route I’m in, example: http://localhost:3000/users/images/icons/favicon.png or http://localhost:3000/players/images/icons/favicon.png.

If I use trailingSlash: "always" the generated .html is empty! 0 KB!

Read more comments on GitHub >

github_iconTop Results From Across the Web

266 bus Route Map - Bot Boyer Markt - Moovit
The 266 bus (Bot Boyer Markt) has 16 stops departing from Bot Zob Berliner Platz and ending in Bot Boyer Markt. 266 bus...
Read more >
Windows 10 hyper-v default switch problems when VPN ...
The problem seems like there is no routing from default switch to VPN. ... Sure you can set up vms with an external...
Read more >
ata-dallas-737-800 & -300 tools - Starman Auctions
266, HOIST,BOOM THRUST W/FORCE GAUGE, AIR SPARES, I C78026-156. 267, HOIST,FISHPOLE, MORGAN AERO, AP6108. 268, HOIST, FISHPOLE 737, MORGAN AERO, AP6108.
Read more >
Los Angeles - 266 Metro Local Line • Bus route • Transitland
Metro - Los Angeles - 266 Metro Local Line is a Bus route available for browsing and analyzing on the Transitland platform.
Read more >
266 bus route - Transport for London
266. Towards Brent Cross. From: Acton Old Town Hall To: Brent Cross Shopping Centre.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found