T
TanStack4w ago
absent-sapphire

Deploy node-server with nitro

How did you solve it? I'm having this error in coolify, locally it's ok, but in production it gives this error
> start
> node .output/server/index.mjs

Listening on http://0.0.0.0:80
npm warn config production Use `--omit=dev` instead.
[h3] Implicit event handler conversion is deprecated. Use `eventHandler()` or `fromNodeMiddleware()` to define event handlers.
Handler: (event) => handler(event.req, event.context)
TypeError: Invalid URL
at new URL (node:internal/url:816:29)
... 7 lines matching cause stack trace ...
at async Server.toNodeHandle (file:///app/.output/server/index.mjs:1829:7) {
cause: TypeError: Invalid URL
at new URL (node:internal/url:816:29)
at startRequestResolver (file:///app/.output/server/chunks/virtual/entry.mjs:854:17)
at file:///app/.output/server/chunks/virtual/entry.mjs:441:13
at AsyncLocalStorage.run (node:internal/async_local_storage/async_hooks:91:14)
at file:///app/.output/server/chunks/virtual/entry.mjs:439:35
at Object.handler (file:///app/.output/server/chunks/virtual/entry.mjs:378:20)
at file:///app/.output/server/index.mjs:1489:43
at async Object.handler (file:///app/.output/server/index.mjs:1558:19)
at async Server.toNodeHandle (file:///app/.output/server/index.mjs:1829:7) {
code: 'ERR_INVALID_URL',
input: '/categorias'
},
status: 500,
statusText: undefined,
headers: undefined,
data: undefined,
body: undefined,
unhandled: true
}
> start
> node .output/server/index.mjs

Listening on http://0.0.0.0:80
npm warn config production Use `--omit=dev` instead.
[h3] Implicit event handler conversion is deprecated. Use `eventHandler()` or `fromNodeMiddleware()` to define event handlers.
Handler: (event) => handler(event.req, event.context)
TypeError: Invalid URL
at new URL (node:internal/url:816:29)
... 7 lines matching cause stack trace ...
at async Server.toNodeHandle (file:///app/.output/server/index.mjs:1829:7) {
cause: TypeError: Invalid URL
at new URL (node:internal/url:816:29)
at startRequestResolver (file:///app/.output/server/chunks/virtual/entry.mjs:854:17)
at file:///app/.output/server/chunks/virtual/entry.mjs:441:13
at AsyncLocalStorage.run (node:internal/async_local_storage/async_hooks:91:14)
at file:///app/.output/server/chunks/virtual/entry.mjs:439:35
at Object.handler (file:///app/.output/server/chunks/virtual/entry.mjs:378:20)
at file:///app/.output/server/index.mjs:1489:43
at async Object.handler (file:///app/.output/server/index.mjs:1558:19)
at async Server.toNodeHandle (file:///app/.output/server/index.mjs:1829:7) {
code: 'ERR_INVALID_URL',
input: '/categorias'
},
status: 500,
statusText: undefined,
headers: undefined,
data: undefined,
body: undefined,
unhandled: true
}
Web:
{
"status": 500,
"unhandled": true,
"message": "HTTPError"
}
{
"status": 500,
"unhandled": true,
"message": "HTTPError"
}
8 Replies
other-emerald
other-emerald4w ago
i'm getting this as well with nitro v2, but works fine with nitro v3. have you tried nitro v3 nightly? package.json:
"nitro": "npm:nitro-nightly@latest",
"nitro": "npm:nitro-nightly@latest",
vite config based on docs:
import { nitro } from "nitro/vite";

export default defineConfig({
plugins: [
tanstackStart(),
nitro(),
// ...
import { nitro } from "nitro/vite";

export default defineConfig({
plugins: [
tanstackStart(),
nitro(),
// ...
this is the setup i'm using on https://github.com/dotnize/react-tanstarter
absent-sapphire
absent-sapphireOP4w ago
So you get this error too?
absent-sapphire
absent-sapphireOP4w ago
@nize
other-emerald
other-emerald4w ago
hmm weird no i'm not getting any errors like that
other-emerald
other-emerald4w ago
No description
absent-sapphire
absent-sapphireOP4w ago
Even with the error I managed to build, maybe it's because of pnpm
other-emerald
other-emerald4w ago
maybe restart vscode?
absent-sapphire
absent-sapphireOP4w ago
nice, it worked, I restarted typescript and the error disappeared and the deploy worked too, thank you very much

Did you find this page helpful?