-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
Which project does this relate to?
Start
Describe the bug
When tsr.srcDirectory
is set to .
server routes and redirects trigger a nitro error "Invalid lazy handler result".
In browser:
{
"error": true,
"url": "http://[::]:3000/",
"statusCode": 500,
"statusMessage": "Server Error",
"message": "Server Error"
}
In server logs:
[request error] [unhandled] [GET] https://5jd49m-3000.csb.app/
TypeError: Invalid lazy handler result. It should be a function:
at file:///project/workspace/.output/server/index.mjs:1473:17
at async Object.handler (file:///project/workspace/.output/server/index.mjs:1557:19)
at async Server.toNodeHandle (file:///project/workspace/.output/server/index.mjs:1828:7) {
cause: TypeError: Invalid lazy handler result. It should be a function:
at file:///project/workspace/.output/server/index.mjs:1473:17
at async Object.handler (file:///project/workspace/.output/server/index.mjs:1557:19)
at async Server.toNodeHandle (file:///project/workspace/.output/server/index.mjs:1828:7),
statusCode: 500,
fatal: false,
unhandled: true,
statusMessage: undefined,
data: undefined
}
Note: this works ok in dev. It is only triggered by building and running a server (tested with node-server and aws-lambda targets).
Your Example Website or App
https://codesandbox.io/p/github/djgrant/repro-tanstack-start/invalid-lazy-handler
Steps to Reproduce the Bug or Issue
- Open sandbox
- Run
npm run build
- Run
node .output/server/index.mjs
- Open preview
- Observe output
Expected behavior
Server routes should not trigger this error.
Screenshots or Videos
No response
Platform
Any
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels