Skip to content

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

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

Closed
kdheepak opened this issue Feb 17, 2022 · 2 comments · Fixed by #4066
Closed

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

kdheepak opened this issue Feb 17, 2022 · 2 comments · Fixed by #4066
Labels
bug Something isn't working

Comments

@kdheepak
Copy link

kdheepak commented Feb 17, 2022

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.

@bluwy bluwy added the bug Something isn't working label Feb 17, 2022
@kdheepak
Copy link
Author

fwiw I think I'm getting the same error when using goto('/') as well.

@madeleineostoja
Copy link

Yep I ran into this as well, had to move my index.ts shadow endpoint to a home.json.ts manual endpoint. It was fixed temporarily but seems to have regressed again — initial load works, but navigating back to index results in a faulty data fetch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants