[2.0.1] diagnostics: a request for // crashes the dev server (Invalid URL in describeInitial)

オープン
#752 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@bryanlundberg がすでに取り組んでいます。

2026年11月28日 から。

  • #753 @bryanlundberg による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
typescript, vite
領域
frontend

調査の方向性

Start with describeInitial and the related URL construction call sites in src/routers/factory.tsx, then inspect the router tests for the appropriate location to add a regression case. Reproduce with a development server configured for SSR and diagnostics, or exercise the affected code through the existing test harness. The work is done when a request path beginning with // no longer throws an uncaught Invalid URL error and the server continues running.

索引モデルが issue の本文から書いたものです。

説明

Describe the bug

With @solidjs/vite-plugin's diagnostics: true, a page request whose path is // crashes the whole Vite dev server with an uncaught TypeError: Invalid URL.

The router declares the initial route for attribution through OBSERVE.attribution.withOrigin(describeInitial(...)). describeInitial resolves the location with new URL(to(), mockBase). For // that's a protocol-relative URL with an empty host, so the constructor throws. The getter is read in settleRender, outside any try/catch, so the dev process exits.

The same request answers 200 with diagnostics: false, and in the production build (node dist/server/node.js).

Versions: @solidjs/router 2.0.1 (the code is unchanged on main), solid-js 2.0.4, @solidjs/web 2.0.4, @solidjs/vite-plugin 3.0.1, vite 8.4.0.

Steps to Reproduce the Bug or Issue
  1. Start mode with ssr: true and diagnostics: true, Solid Router 2 mounted in App; pnpm dev
  2. curl 'http://localhost:3000//'
  3. The dev server exits:
TypeError: Invalid URL
    at new URL (node:internal/url:819:25)
    at pathname (@solidjs/router/dist/routers/factory.jsx:104:28)
    at Object.<Routes routerState={routerState} branches={branches}/> (@solidjs/router/dist/routers/factory.jsx:112:37)
    at Object.settle (@solidjs/web/dist/server.dev.js:357:19)
    ...
  code: 'ERR_INVALID_URL',
  input: '//',
  base: 'http://sr'
Expected behavior

The request renders (or 404s) and the dev server keeps running.

Platform
  • OS: Linux
  • Browser: any (also plain curl)
  • Node: 24.14.1
Additional context

Other new URL(…, mockBase) calls in factory.tsx may have the same problem for paths starting with //, e.g. the navigation attribution's pathname.

Workaround: a start middleware that redirects paths with repeated slashes to their single-slash form.

主要言語
TypeScript
スター
1.3k
フォーク
193
平均マージ
8時間 48分
マージ済み PR(30日)
21

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

solidjs/solid-router のほかの issue

solidjs/solid-router の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。