-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
Describe the bug
If a page uses goto() to redirect to itself (say, to change a query parameter), and if the page has a ghost POST endpoint but no ghost GET endpoint, goto will result in displaying a 404 error page.
Reproduction
- Clone https://github.com/moatra/missing_get_redirect
- npm install
- npm run dev
- Open localhost:3000 in a browser.
- With javascript enabled, click "Submit Me". (exercises client-side
goto)- Expected: Page updates appropriately
- Actual: 404 error page
- With javascript disabled, click "Submit Me" (exercises normal http redirect)
- Expected: Page updates appropriately
- Actual page updates appropriately
Logs
Browser Request Logs
----------------------
POST http://localhost:3000/ [HTTP/1.1 200 OK 3ms]
GET http://localhost:3000/index.svelte?t=1647132611566 [HTTP/1.1 304 Not Modified 1 ms]
GET http://localhost:3000/__data.json?submitted [HTTP/1.1 404 Not Found 4ms]
Error Page Output:
----------------------
Failed to load data
load_route@http://localhost:3000/@fs/home/thomas/Projects/sveltekit_repros/missing_get_redirect/.svelte-kit/runtime/client/start.js:885:16
async*get_navigation_result@http://localhost:3000/@fs/home/thomas/Projects/sveltekit_repros/missing_get_redirect/.svelte-kit/runtime/client/start.js:603:25
update@http://localhost:3000/@fs/home/thomas/Projects/sveltekit_repros/missing_get_redirect/.svelte-kit/runtime/client/start.js:428:33
navigate@http://localhost:3000/@fs/home/thomas/Projects/sveltekit_repros/missing_get_redirect/.svelte-kit/runtime/client/start.js:1117:9
goto@http://localhost:3000/@fs/home/thomas/Projects/sveltekit_repros/missing_get_redirect/.svelte-kit/runtime/client/start.js:389:11
goto@http://localhost:3000/@fs/home/thomas/Projects/sveltekit_repros/missing_get_redirect/.svelte-kit/runtime/client/start.js:1180:34
on_submit@http://localhost:3000/src/routes/_enhance.js:15:13
async*form_enhance@http://localhost:3000/src/routes/_enhance.js:17:10
mount@http://localhost:3000/src/routes/index.svelte:135:67
createProxiedComponent/instrument/targetCmp.$$.fragment.m@http://localhost:3000/node_modules/svelte-hmr/runtime/svelte-hooks.js:291:25
mount_component@http://localhost:3000/node_modules/.vite/chunk-MHSN3BS3.js?v=e363d3f8:1626:24
mount@http://localhost:3000/.svelte-kit/generated/root.svelte:275:20
mount@http://localhost:3000/.svelte-kit/generated/root.svelte:564:40
mount@http://localhost:3000/.svelte-kit/runtime/components/layout.svelte:32:18
createProxiedComponent/instrument/targetCmp.$$.fragment.m@http://localhost:3000/node_modules/svelte-hmr/runtime/svelte-hooks.js:291:25
mount_component@http://localhost:3000/node_modules/.vite/chunk-MHSN3BS3.js?v=e363d3f8:1626:24
mount@http://localhost:3000/.svelte-kit/generated/root.svelte:174:20
mount@http://localhost:3000/.svelte-kit/generated/root.svelte:760:40
mount_component@http://localhost:3000/node_modules/.vite/chunk-MHSN3BS3.js?v=e363d3f8:1626:24
init@http://localhost:3000/node_modules/.vite/chunk-MHSN3BS3.js?v=e363d3f8:1705:20
Root@http://localhost:3000/.svelte-kit/generated/root.svelte:920:7
createProxiedComponent@http://localhost:3000/node_modules/svelte-hmr/runtime/svelte-hooks.js:341:9
ProxyComponent@http://localhost:3000/node_modules/svelte-hmr/runtime/proxy.js:242:29
Proxy<Root>@http://localhost:3000/node_modules/svelte-hmr/runtime/proxy.js:349:11
initialize@http://localhost:3000/@fs/home/thomas/Projects/sveltekit_repros/missing_get_redirect/.svelte-kit/runtime/client/start.js:564:10
_hydrate@http://localhost:3000/@fs/home/thomas/Projects/sveltekit_repros/missing_get_redirect/.svelte-kit/runtime/client/start.js:1475:14
async*start@http://localhost:3000/@fs/home/thomas/Projects/sveltekit_repros/missing_get_redirect/.svelte-kit/runtime/client/start.js:1511:16
@http://localhost:3000/:25:8System Info
❯ npx envinfo --system --binaries --browsers --npmPackages "{svelte,@sveltejs/*,vite}"
System:
OS: Linux 5.15 Fedora Linux 35 (Workstation Edition)
CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor
Memory: 21.54 GB / 31.33 GB
Container: Yes
Shell: 5.1.8 - /bin/bash
Binaries:
Node: 16.13.0 - /usr/bin/node
npm: 8.1.0 - /usr/bin/npm
Browsers:
Firefox: 96.0
npmPackages:
@sveltejs/adapter-auto: next => 1.0.0-next.31
@sveltejs/kit: next => 1.0.0-next.295
svelte: ^3.44.0 => 3.46.4Severity
serious, but I can work around it
Additional Information
Workaround is to provide a GET endpoint that returns a 200 response, but that seems to be an unnecessary network request.
Metadata
Metadata
Assignees
Labels
No labels