Skip to content

[Bug?]: TypeError: Invalid URL on production builds #2124

@mckeenicholas

Description

@mckeenicholas

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

When loading / (or any url for that matter) on the production build of the default template, an error 500 is returned with the following output

TypeError: Invalid URL
    at new URL (node:internal/url:819:25)
    ... 8 lines matching cause stack trace ...
    at process.processTicksAndRejections (node:internal/process/task_queues:103:5) {
  cause: TypeError: Invalid URL
      at new URL (node:internal/url:819:25)
      at get _url (file://~/solid-project/.output/server/node_modules/srvx/dist/_chunks/_url.mjs:43:16)
      at get pathname (file://~/solid-project/.output/server/node_modules/srvx/dist/_chunks/_url.mjs:75:43)
      at H3._findRoute (file://~/solid-project/.output/server/chunks/virtual/entry.mjs:665:62)
      at H3.handler (file://~/solid-project/.output/server/chunks/virtual/entry.mjs:584:23)
      at H3._request (file://~/solid-project/.output/server/chunks/virtual/entry.mjs:563:30)
      at H3.fetch (file://~/solid-project/.output/server/chunks/virtual/entry.mjs:551:16)
      at Object._webHandler [as handler] (file://~/solid-project/.output/server/chunks/virtual/entry.mjs:677:10)
      at file://~/solid-project/.output/server/chunks/nitro/nitro.mjs:1490:43
      at process.processTicksAndRejections (node:internal/process/task_queues:103:5) {
    code: 'ERR_INVALID_URL',
    input: '/'
  },
  status: 500,
  statusText: undefined,
  headers: undefined,
  data: undefined,
  body: undefined,
  unhandled: true
}

(Absolute paths have been redacted and replaced with ~)

The browser dispalys: {"status":500,"unhandled":true,"message":"HTTPError"}.

Issue appears to be from trying to load a relative path into NativeURL, however I don't know enough about how nitro/the router works to look further.

Expected behavior 🤔

Should load the base route of the project.

Steps to reproduce 🕹

Steps:

  1. Run npm create solid@latest
  2. Select SolidStart, v2, typescript, basic
  3. Run cd solid-project, npm i, npm run build
  4. Run node .output/server/index.mjs
  5. Open localhost:3000 in the browser

Same issue exists by following the above steps but with bun.

Context 🔦

Ran into this issue when trying to build a fullstack app, coundln't find any info online, and I assume its not my issue since it exists in a template project.

Your environment 🌎

System:
  OS: Ubuntu 22.04.5 LTS (WSL2)
  CPU: Intel i5 13600k
Binaries:
  Node: v24.13.1
  npm: 11.8.0
  Bun: 1.3.10
package.json
  "@solidjs/router": "^0.15.0"
  "@solidjs/start": "2.0.0-alpha.2"
  "@solidjs/vite-plugin-nitro-2": "^0.1.0"
  "solid-js": "^1.9.5"
  "vite": "7"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions