Skip to content

Unable to use index.svelte with a shadow endpoint index.ts #3974

Closed
@kdheepak

Description

@kdheepak

Describe the bug

I get the following error on internal routing to the root url:

404

Failed to load data

_load@https://svelte-kit-test.kdheepak.com/_app/start-f0f2a705.js:1:22348
async*_get_navigation_result@https://svelte-kit-test.kdheepak.com/_app/start-f0f2a705.js:1:19338
update@https://svelte-kit-test.kdheepak.com/_app/start-f0f2a705.js:1:17196
handle_navigation@https://svelte-kit-test.kdheepak.com/_app/start-f0f2a705.js:1:17109
_navigate@https://svelte-kit-test.kdheepak.com/_app/start-f0f2a705.js:1:12898
init_listeners/<@https://svelte-kit-test.kdheepak.com/_app/start-f0f2a705.js:1:10324
EventListener.handleEvent*init_listeners@https://svelte-kit-test.kdheepak.com/_app/start-f0f2a705.js:1:9696
it@https://svelte-kit-test.kdheepak.com/_app/start-f0f2a705.js:1:24041
async*@https://svelte-kit-test.kdheepak.com/:28:8

And I get the following in the console:

https://svelte-kit-test.kdheepak.com/__data.json

Screen Shot 2022-02-17 at 1 20 44 AM

Reproduction

Reproducible using https://github.com/kdheepak/svelte-kit-test and adapter-static, on github pages.

  1. Go to https://svelte-kit-test.kdheepak.com/
  2. Click on link that takes you to https://svelte-kit-test.kdheepak.com/link
  3. Click on link that takes you to https://svelte-kit-test.kdheepak.com/

Logs

_load@https://svelte-kit-test.kdheepak.com/_app/start-f0f2a705.js:1:22348
async*_get_navigation_result@https://svelte-kit-test.kdheepak.com/_app/start-f0f2a705.js:1:19338
update@https://svelte-kit-test.kdheepak.com/_app/start-f0f2a705.js:1:17196
handle_navigation@https://svelte-kit-test.kdheepak.com/_app/start-f0f2a705.js:1:17109
_navigate@https://svelte-kit-test.kdheepak.com/_app/start-f0f2a705.js:1:12898
init_listeners/<@https://svelte-kit-test.kdheepak.com/_app/start-f0f2a705.js:1:10324
EventListener.handleEvent*init_listeners@https://svelte-kit-test.kdheepak.com/_app/start-f0f2a705.js:1:9696
it@https://svelte-kit-test.kdheepak.com/_app/start-f0f2a705.js:1:24041
async*@https://svelte-kit-test.kdheepak.com/:28:8

System Info

npx envinfo --system --binaries --browsers --npmPackages "{svelte,@sveltejs/*,vite}"                                       ─╯

  System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i7-3615QM CPU @ 2.30GHz
    Memory: 4.47 GB / 16.00 GB
    Shell: 5.8 - /usr/local/bin/zsh
  Binaries:
    Node: 17.1.0 - ~/miniconda3/bin/node
    npm: 8.1.2 - ~/miniconda3/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  npmPackages:
    @sveltejs/adapter-static: next => 1.0.0-next.28
    @sveltejs/kit: next => 1.0.0-next.276
    svelte: ^3.46.4 => 3.46.4

Severity

blocking all usage of SvelteKit

Additional Information

I believe the error has something to do with this:

const res = await fetch(
`${url.pathname}${url.pathname.endsWith('/') ? '' : '/'}__data.json${url.search}`,
{
headers: {
'x-sveltekit-load': 'true'
}
}
);

This is the same issue that was occurring in #3718. When I tested it, I thought I remember it not doing this any more and assumed it was fixed. I could be misremembering or it is possible that something else has caused a regression since then. Possibly related to #3532.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions