Skip to content

Commit 576d60d

Browse files
authored
fix: return 404 when server function not found (#1775)
1 parent a79e452 commit 576d60d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

packages/start/src/runtime/server-handler.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,13 @@ async function handleServerFunction(h3Event: HTTPEvent) {
8787
} else {
8888
functionId = url.searchParams.get("id");
8989
name = url.searchParams.get("name");
90-
if (!functionId || !name) throw new Error("Invalid request");
90+
if (!functionId || !name) return new Response("Server function not found", { status: 404 });
9191
}
9292

9393
const serverFnInfo = serverFnManifest[functionId];
9494
let fnModule: undefined | { [key: string]: any };
9595

96+
if (!serverFnInfo) return new Response("Server function not found", { status: 404 });
9697

9798
if (process.env.NODE_ENV === "development") {
9899
// In dev, we use Vinxi to get the "server" server-side router

0 commit comments

Comments
 (0)