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

Aberta
#752 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

@bryanlundberg já está trabalhando nisso.

Desde 28/11/2026.

  • #753 de @bryanlundberg — aberto

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
35/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Estagnada
Stack de tecnologia
typescript, vite
Domínio
frontend

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
TypeScript
Estrelas
1.3k
Forks
193
Merge médio
8h 48min
PRs com merge (30d)
21

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de solidjs/solid-router

Todas as issues de solidjs/solid-router

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.