T
TanStack•2mo ago
rare-sapphire

nitro v3 is not working for me

I can build but when i run the app i get errors
Listening on http://[::]:3000
TypeError: r.split is not a function
Listening on http://[::]:3000
TypeError: r.split is not a function
switching back to nitri v2 and everything works again.
13 Replies
graceful-beige
graceful-beige•2mo ago
Lolz I had one too 😄 getting this error when calling better auth.
import { createIsomorphicFn } from "@tanstack/react-start";
import { getRequestHeaders } from "@tanstack/react-start/server";

export const getAuthSession = createIsomorphicFn()
.server(() => {
const headers = getRequestHeaders();

console.log(headers);

// const session = await auth.api.getSession({
// headers,
// });

// console.log(session);

// if (!session?.session) {
// return null;
// }

return {
user: "user",
// session: session?.session,
// email: session?.user?.email,
};
})
.client(() => {
// const { data: userSession } = await authClient.getSession();
// if (!userSession) {
// return null;
// }

return {
user: "user",
// session: userSession?.session,
// email: userSession?.user?.email,
};
});
import { createIsomorphicFn } from "@tanstack/react-start";
import { getRequestHeaders } from "@tanstack/react-start/server";

export const getAuthSession = createIsomorphicFn()
.server(() => {
const headers = getRequestHeaders();

console.log(headers);

// const session = await auth.api.getSession({
// headers,
// });

// console.log(session);

// if (!session?.session) {
// return null;
// }

return {
user: "user",
// session: session?.session,
// email: session?.user?.email,
};
})
.client(() => {
// const { data: userSession } = await authClient.getSession();
// if (!userSession) {
// return null;
// }

return {
user: "user",
// session: userSession?.session,
// email: userSession?.user?.email,
};
});
stormy-gold
stormy-gold•2mo ago
can you both please post in https://discord.com/channels/719702312431386674/1431621556718534798 please provide a complete example project also please try using nitro nightly, not nitrov3 alpha use this in your package.json "nitro": "npm:nitro-nightly@latest",
rare-sapphire
rare-sapphireOP•2mo ago
Using alpha didn't fix it.
graceful-beige
graceful-beige•2mo ago
I have sooo many different weird errors.. No server actions all commented out..
VITE v7.1.10 ready in 587 ms

➜ Local: http://localhost:3001/
➜ Network: use --host to expose
➜ press h + enter to show help
node:internal/url:826
href = bindingUrl.parse(input, base, true);
^

TypeError: Invalid URL
at new URL (node:internal/url:826:25)
at fetchAddress (file:///Users/franciszekstodulski/Dev/@others/wizytka/apps/admin/node_modules/nitro/dist/_chunks/app.mjs:775:11)
at NodeDevWorker.fetch (file:///Users/franciszekstodulski/Dev/@others/wizytka/apps/admin/node_modules/nitro/dist/_chunks/app.mjs:845:12)
at FetchableDevEnvironment.dispatchFetch (file:///Users/franciszekstodulski/Dev/@others/wizytka/apps/admin/node_modules/nitro/dist/_chunks/plugin.mjs:329:27)
at nitroDevMiddleware (file:///Users/franciszekstodulski/Dev/@others/wizytka/apps/admin/node_modules/nitro/dist/_chunks/plugin.mjs:437:35) {
code: 'ERR_INVALID_URL',
input: '[object Request]'
}

Node.js v24.4.1
error: script "dev" exited with code 1
VITE v7.1.10 ready in 587 ms

➜ Local: http://localhost:3001/
➜ Network: use --host to expose
➜ press h + enter to show help
node:internal/url:826
href = bindingUrl.parse(input, base, true);
^

TypeError: Invalid URL
at new URL (node:internal/url:826:25)
at fetchAddress (file:///Users/franciszekstodulski/Dev/@others/wizytka/apps/admin/node_modules/nitro/dist/_chunks/app.mjs:775:11)
at NodeDevWorker.fetch (file:///Users/franciszekstodulski/Dev/@others/wizytka/apps/admin/node_modules/nitro/dist/_chunks/app.mjs:845:12)
at FetchableDevEnvironment.dispatchFetch (file:///Users/franciszekstodulski/Dev/@others/wizytka/apps/admin/node_modules/nitro/dist/_chunks/plugin.mjs:329:27)
at nitroDevMiddleware (file:///Users/franciszekstodulski/Dev/@others/wizytka/apps/admin/node_modules/nitro/dist/_chunks/plugin.mjs:437:35) {
code: 'ERR_INVALID_URL',
input: '[object Request]'
}

Node.js v24.4.1
error: script "dev" exited with code 1
stormy-gold
stormy-gold•2mo ago
can you share your full project?
flat-fuchsia
flat-fuchsia•2mo ago
Hey guys 👋 I am here to look for any issues re TSS and Nitro v3. Sharing your projects would be really helpful to investigate issues.
rare-sapphire
rare-sapphireOP•2mo ago
I have on the other side
graceful-beige
graceful-beige•2mo ago
Removed nitro and used srvx to serve my production code - it's amazing how many hours I spend to trying figure it out 😮
rare-sapphire
rare-sapphireOP•2mo ago
How did you use srvx? As a plugin or directly?
graceful-beige
graceful-beige•2mo ago
@Manuel Schiller helped me here 😄
pnpx srvx --prod -s ../client dist/server/server.js
pnpx srvx --prod -s ../client dist/server/server.js
kudos for him 🙂
rare-sapphire
rare-sapphireOP•2mo ago
Let me try
yelping-magenta
yelping-magenta•2mo ago
My frist try I got some errors too, after switchin back to nitro V2 then still got issues, @Manuel Schiller posted that you need have only one Nitro version on your app or got some conflicts, after cleanup and setted Nitro V2 the appp works perfect!

Did you find this page helpful?