Which project does this relate to?
Start
Describe the bug
Server functions live at the /_serverFn/$id route, and they work well. If the build changes, the IDs change - this is good.
However, when a server function is requested at an old ID that no longer exists, the framework returns a 500 and you'll see a bunch of associated logging for the stack trace.
This is causing me, and presumably others, issues when deploying to production because these 500s trigger alerts etc. when they are in fact erroneous. Any other instance of a missing resource would be treated as a 404.
The cause of the issues in production comes from caching. Some of this we can control as website publishers, but some of it we can't. For example, I am currently being repeatedly hit by BingBot during its routine indexing operations (which I want) but it caches and follows server function routes in ways that don't seem to always abide by headers or TTLs. Each time it hits an old server function route that it has discovered and cached from a previous load, I'll get a 500 error.
I've personally worked around this by:
- adding more specific caching headers to the root, route, asset and serverFn routes
- adding more specific robot.txt instructions to disallow serverFn routes
- adding middleware to suppress the "Server function info not found" 500 errors and turn them into 404s
These three things are things that I think the framework should do for you.
Complete minimal reproducer
https://github.com/neverstew/server-fn-500s
Steps to Reproduce the Bug
- Create an empty project - I used the basic template from the docs
- Build it with
npm run build
- Preview with
npx vite preview
curl -i http://localhost:3000/_serverFn/test
neverstew@mattbook ~/d/a/start-basic> curl -i http://localhost:3000/_serverFn/test
HTTP/1.1 500 Internal Server Error
Vary: Origin
content-type: application/json;charset=UTF-8
content-length: 53
Date: Thu, 07 May 2026 21:14:00 GMT
Connection: keep-alive
Keep-Alive: timeout=5
{"status":500,"unhandled":true,"message":"HTTPError"}⏎
neverstew@mattbook ~/d/a/start-basic> npx vite preview
╭────────── [Build Info] ────────────╮
│ │
│ - Build Directory: .output │
│ - Date: 07/05/2026, 22:13:44 │
│ - Nitro Version: 3.0.260311-beta │
│ - Nitro Preset: node-server │
│ │
╰────────────────────────────────────╯
➜ Local: http://localhost:3000/
➜ Network: use --host to expose
➜ press h + enter to show help
Error: Server function info not found for test
at getServerFnById (file:///Users/neverstew/dev/abitat/start-basic/.output/server/_ssr/ssr.mjs:144:27)
... 8 lines matching cause stack trace ...
at async Object.fetch (file:///Users/neverstew/dev/abitat/start-basic/.output/server/_ssr/ssr.mjs:1586:10) {
cause: Error: Server function info not found for test
at getServerFnById (file:///Users/neverstew/dev/abitat/start-basic/.output/server/_ssr/ssr.mjs:144:27)
at handleServerAction (file:///Users/neverstew/dev/abitat/start-basic/.output/server/_ssr/ssr.mjs:587:23)
at file:///Users/neverstew/dev/abitat/start-basic/.output/server/_ssr/ssr.mjs:1411:15
at AsyncLocalStorage.run (node:internal/async_local_storage/async_context_frame:63:14)
at runWithStartContext (file:///Users/neverstew/dev/abitat/start-basic/.output/server/_ssr/ssr.mjs:199:22)
at serverFnHandler (file:///Users/neverstew/dev/abitat/start-basic/.output/server/_ssr/ssr.mjs:1404:13)
at next (file:///Users/neverstew/dev/abitat/start-basic/.output/server/_ssr/ssr.mjs:1261:19)
at executeMiddleware (file:///Users/neverstew/dev/abitat/start-basic/.output/server/_ssr/ssr.mjs:1279:9)
at startRequestResolver (file:///Users/neverstew/dev/abitat/start-basic/.output/server/_ssr/ssr.mjs:1417:42)
at async Object.fetch (file:///Users/neverstew/dev/abitat/start-basic/.output/server/_ssr/ssr.mjs:1586:10),
status: 500,
statusText: undefined,
headers: undefined,
data: undefined,
body: undefined,
unhandled: true
}
Expected behavior
A nicely handled response with something informative and a 404 status.
No stack trace in the logs.
Screenshots or Videos
No response
Platform
- Router / Start Version: 1.167.65
- OS: macOS, Linux, (presumably Windows - untested)
- Browser: N/A
- Bundler: vite
- Bundler Version: 8.0.0
Additional context
No response
Which project does this relate to?
Start
Describe the bug
Server functions live at the
/_serverFn/$idroute, and they work well. If the build changes, the IDs change - this is good.However, when a server function is requested at an old ID that no longer exists, the framework returns a 500 and you'll see a bunch of associated logging for the stack trace.
This is causing me, and presumably others, issues when deploying to production because these 500s trigger alerts etc. when they are in fact erroneous. Any other instance of a missing resource would be treated as a 404.
The cause of the issues in production comes from caching. Some of this we can control as website publishers, but some of it we can't. For example, I am currently being repeatedly hit by BingBot during its routine indexing operations (which I want) but it caches and follows server function routes in ways that don't seem to always abide by headers or TTLs. Each time it hits an old server function route that it has discovered and cached from a previous load, I'll get a 500 error.
I've personally worked around this by:
These three things are things that I think the framework should do for you.
Complete minimal reproducer
https://github.com/neverstew/server-fn-500s
Steps to Reproduce the Bug
npm run buildnpx vite previewcurl -i http://localhost:3000/_serverFn/testExpected behavior
A nicely handled response with something informative and a 404 status.
No stack trace in the logs.
Screenshots or Videos
No response
Platform
Additional context
No response