Which project does this relate to?
Start
Describe the bug
When re-exporting a server function factory (created with createServerFn().middleware([...])), the export syntax affects whether middleware executes. Using export { foo } from "./module" or export * from "./module" causes middleware to be silently skipped, resulting in an empty context object.
Your Example Website or App
https://github.com/AbdulAAhmad/start-bare-serverfn-factories-export
Steps to Reproduce the Bug or Issue
- Clone the repo and run
nvm use && pnpm install && pnpm dev
- Navigate to / route
- Observe console: context {} — middleware did not run
- In src/lib/index.ts, switch from:
export { authedServerFn } from "./wrappers";
to:
import { authedServerFn } from "./wrappers";
export { authedServerFn };
- Refresh the page
- Observe console: AUTH MIDDLEWARE RUNNING and context { user: {...}, session: {...} }
Expected behavior
Export syntax should not affect middleware execution. Both export styles should result in middleware running and context being populated.
Screenshots or Videos
No response
Platform
- Router / Start Version: 1.139.14
- OS: macOS
- Browser: Chrome
- Browser Version: N/A
- Bundler: vite
- Bundler Version: 7.1.7
Additional context
No response
Which project does this relate to?
Start
Describe the bug
When re-exporting a server function factory (created with createServerFn().middleware([...])), the export syntax affects whether middleware executes. Using
export { foo } from "./module"orexport * from "./module"causes middleware to be silently skipped, resulting in an empty context object.Your Example Website or App
https://github.com/AbdulAAhmad/start-bare-serverfn-factories-export
Steps to Reproduce the Bug or Issue
nvm use && pnpm install && pnpm devexport { authedServerFn } from "./wrappers";
to:
import { authedServerFn } from "./wrappers";
export { authedServerFn };
Expected behavior
Export syntax should not affect middleware execution. Both export styles should result in middleware running and context being populated.
Screenshots or Videos
No response
Platform
Additional context
No response