Repository navigation
[Bug?]: TypeError: Invalid URL on production builds #2124
Description
Activity
make sure you don't have multiple versions of h3 installed
The multiple h3 seem to be the root cause, but is created by @solidjs/vite-plugin-nitro-2 pulling in another version than @solidjs/start.
I think a new compatible version of vite-plugin-nitro-2 needs to be released. Even the 0.2.0 (with alfa flag) is pulling in the 1.x version of h3, instead of the 2.x-rc
The workaround I have found is switching from npm to pnpm as package manager. Then it works.
From my side, I think I'm hitting the same bug on a production SolidStart v2 app, and from what I can see the break seems to happen here:
The generated .output/server/chunks/virtual/entry.mjs contains h3 v2's fromWebHandler:
function fromWebHandler(handler) { return function _webHandler(event) { return handler(event.req, event.context); }; }
As far as I can tell this _webHandler ends up being invoked by nitro.mjs, which from what I can see still uses h3 v1 internally. In h3 v1, event.req appears to be a deprecated getter:
/** @deprecated Please use `event.node.req` instead. */ get req() { return this.node.req; // Node.js IncomingMessage }
So if I'm reading this correctly, _webHandler receives an h3 v1 event and pulls event.req, which returns a Node.js IncomingMessage rather than a Web Request. That then gets passed to the h3 v2 handler, which does new FastURL(req.url) where req.url is just "/" (since Node IncomingMessages use path-only URLs). FastURL seems to store "/" as the href, and when the pathname getter falls back to new NativeURL(this.href) you end up with new URL("/") → TypeError: Invalid URL.
So from what I can see, the issue looks like the h3 v1 ↔ h3 v2 bridge in the node-server preset isn't converting IncomingMessage → Web Request before handing off to the h3 v2 handler — but I'm not deep enough in this stack to be sure that's the full picture.
One thing worth noting from my testing: @solidjs/vite-plugin-nitro-2@0.2.0 doesn't seem to fix it on my end (I tried the pkg.pr.new build of PR #2116). Both 0.1.0 and 0.2.0 still seem to pull in h3 v1 via nitropack, and the bundled srvx inside .output/server/node_modules/.nitro/srvx@0.11.15 appears to be reached via the v1 path regardless.
The pnpm workaround mentioned above might be working because pnpm's stricter dep resolution deduplicates h3 — that's just a guess though.
For anyone else blocked, I ended up reverting to SolidStart v1 + Vinxi while waiting for this to settle.
Reacted by Michael Haar, Buntu Cossie, Nawfel and Sean AlunniI was facing this issue. It doesn't seem to be fixed yet with other package managers; I'm using pnpm for now.
Is there some setup of the override feature that could be used to fix this?
- addedStart 2.xtargeting SolidStart 2.x versionstargeting SolidStart 2.x versions
on Jul 17, 2026 The Nitro v2 vite plugin is deprecated. Please reopen if this also happens with Nitro v3 / Vite 8 / latest SolidStart pre-release.
Duplicates
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(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:
npm create solid@latestSolidStart,v2,typescript,basiccd solid-project,npm i,npm run buildnode .output/server/index.mjslocalhost:3000in the browserSame 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 🌎