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

create-svelte@next SvelteKit demo app errors on request.query and $page.path deprecation #3140

Closed
jangerhofer opened this issue Dec 30, 2021 · 0 comments · Fixed by #3146
Closed

Comments

@jangerhofer
Copy link

jangerhofer commented Dec 30, 2021

Describe the bug

A fresh copy of the demo app errors upon building the template app (via svelte-kit dev) with one of two errors (once the first is resolved, the second appears):

  • request.query has been replaced by request.url.searchParams
  • $page.path has been replaced by $page.url.pathname

Each error apparently prevents compilation and I am unable to load the app in a browser.

Reproduction

$ npm init svelte@next my-app

✔ Which Svelte app template? --> SvelteKit demo app
✔ Use TypeScript? --> Yes
✔ Add ESLint for code linting? --> Yes
✔ Add Prettier for code formatting? -->/ Yes

$ npm install

$ npm run dev

Logs

$ npm run dev

> my-app@0.0.1 dev
> svelte-kit dev

Pre-bundling dependencies:
  svelte/store
  svelte
  svelte/transition
  svelte/animate
  svelte/motion
  (...and 2 more)
(this will be run only when your dependencies or config have changed)

  SvelteKit v1.0.0-next.208

  local:   http://localhost:3000
  network: not exposed

  Use --host to expose server to other devices on this network


request.query has been replaced by request.url.searchParams
Error: request.query has been replaced by request.url.searchParams
    at Object.get (file:///Users/jdangerhofer/tmp/my-app/node_modules/@sveltejs/kit/dist/ssr.js:1753:12)
    at Object.handle (/Users/jdangerhofer/tmp/my-app/src/hooks.ts:10:30)
    at respond (file:///Users/jdangerhofer/tmp/my-app/node_modules/@sveltejs/kit/dist/ssr.js:1764:30)
    at svelteKitMiddleware (file:///Users/jdangerhofer/tmp/my-app/node_modules/@sveltejs/kit/dist/chunks/index.js:4577:28)

 [vite] page reload src/hooks.ts

$page.path has been replaced by $page.url.pathname
Error: $page.path has been replaced by $page.url.pathname
    at Object.get (file:///Users/jdangerhofer/tmp/my-app/node_modules/@sveltejs/kit/dist/ssr.js:583:13)
    at Header.svelte:18:31
    at Object.$$render (/Users/jdangerhofer/tmp/my-app/node_modules/svelte/internal/index.js:1702:22)
    at eval (/src/routes/__layout.svelte:20:94)
    at Object.$$render (/Users/jdangerhofer/tmp/my-app/node_modules/svelte/internal/index.js:1702:22)
    at root.svelte:37:45
    at $$render (/Users/jdangerhofer/tmp/my-app/node_modules/svelte/internal/index.js:1702:22)
    at Object.render (/Users/jdangerhofer/tmp/my-app/node_modules/svelte/internal/index.js:1710:26)
    at render_response (file:///Users/jdangerhofer/tmp/my-app/node_modules/@sveltejs/kit/dist/ssr.js:606:28)
    at async respond$1 (file:///Users/jdangerhofer/tmp/my-app/node_modules/@sveltejs/kit/dist/ssr.js:1429:4)

$page.path has been replaced by $page.url.pathname
Error: $page.path has been replaced by $page.url.pathname
    at Object.get (file:///Users/jdangerhofer/tmp/my-app/node_modules/@sveltejs/kit/dist/ssr.js:583:13)
    at Header.svelte:18:31
    at Object.$$render (/Users/jdangerhofer/tmp/my-app/node_modules/svelte/internal/index.js:1702:22)
    at eval (/src/routes/__layout.svelte:20:94)
    at Object.$$render (/Users/jdangerhofer/tmp/my-app/node_modules/svelte/internal/index.js:1702:22)
    at root.svelte:37:45
    at $$render (/Users/jdangerhofer/tmp/my-app/node_modules/svelte/internal/index.js:1702:22)
    at Object.render (/Users/jdangerhofer/tmp/my-app/node_modules/svelte/internal/index.js:1710:26)
    at render_response (file:///Users/jdangerhofer/tmp/my-app/node_modules/@sveltejs/kit/dist/ssr.js:606:28)
    at async respond_with_error (file:///Users/jdangerhofer/tmp/my-app/node_modules/@sveltejs/kit/dist/ssr.js:1195:10)

System Info

System:
    OS: macOS 12.2
    CPU: (10) arm64 Apple M1 Max
    Memory: 1.41 GB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.0 - /usr/local/bin/node
    npm: 8.1.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 96.0.4664.110
    Safari: 15.3
  npmPackages:
    @sveltejs/adapter-auto: next => 1.0.0-next.6 
    @sveltejs/kit: next => 1.0.0-next.208 
    svelte: ^3.44.0 => 3.44.3

Severity

annoyance

Additional Information

I believe #3126 introduced these two deprecations (along with other apparently related deprecations). I also see that the create-svelte template was updated in accordance with the deprecations in that PR.

I can easily resolve both errors then load the app simply by making the aforementioned template changes manually. Specifically, I update one line in hooks.ts and three nearly-contiguous lines in Header.svelte to match their current state in master.

I am not sure if I just wound up with some sort of version mismatch or if there is a deeper problem at play which warrants further investigation.

@Rich-Harris Rich-Harris mentioned this issue Dec 30, 2021
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant