fix: dev serverfn resolution on windows #5520
main fromrefs/pull/5520/head·merged by schiller-manuel(GitHub profile, opens in a new tab) Summary by CodeRabbit#
- Chores
- Internal improvements to server function handling and file path normalization to enhance system reliability.
- 1
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: server-functions-plugin
github-actions[bot](GitHub profile, opens in a new tab) added labelspackage: start-server-core
View your CI Pipeline Execution ↗ for commit f535282c8d8792267e2e13763f614560bbb5ffe9
Command Status Duration Result nx affected --targets=test:eslint,test:unit,tes...✅ Succeeded 4m 46s View ↗ nx run-many --target=build --exclude=examples/*...✅ Succeeded 21s View ↗
☁️ Nx Cloud last updated this comment at
2025-10-17 22:09:21UTCMore templates
- tanstack-router-solid-example-basic
- tanstack-router-solid-example-basic-devtools-panel
- tanstack-router-solid-example-basic-file-based
- tanstack-router-solid-example-basic-non-nested-devtools
- tanstack-router-solid-example-basic-solid-query
- tanstack-router-solid-example-basic-solid-query-file-based
- tanstack-router-solid-example-basic-ssr-streaming-file-based
- tanstack-router-solid-example-kitchen-sink-file-based
- tanstack-router-solid-example-quickstart-file-based
- tanstack-solid-start-example-bare
- tanstack-solid-start-example-basic
- tanstack-solid-start-example-basic-static
- tanstack-router-react-example-authenticated-routes
- tanstack-router-react-example-authenticated-routes-firebase
- tanstack-router-react-example-basic
- tanstack-router-react-example-basic-default-search-params
- tanstack-router-react-example-basic-devtools-panel
- tanstack-router-react-example-basic-file-based
- tanstack-router-react-example-basic-non-nested-devtools
- tanstack-router-react-example-react-query
- tanstack-router-react-example-basic-react-query-file-based
- tanstack-router-react-example-basic-ssr-file-based
- tanstack-router-react-example-basic-ssr-streaming-file-based
- tanstack-router-react-example-basic-virtual-file-based
- tanstack-router-react-example-basic-virtual-inside-file-based
- tanstack-router-react-example-deferred-data
- tanstack-router-i18n-paraglide
- tanstack-router-react-example-kitchen-sink
- tanstack-router-react-example-kitchen-sink-file-based
- tanstack-router-react-example-kitchen-sink-react-query
- tanstack-router-react-example-kitchen-sink-react-query-file-based
- tanstack-router-react-example-large-file-based
- tanstack-router-react-example-location-masking
- tanstack-router-react-example-navigation-blocking
- tanstack-router-react-example-quickstart
- tanstack-router-react-example-quickstart-esbuild-file-based
- tanstack-router-react-example-quickstart-file-based
- tanstack-router-react-example-quickstart-rspack-file-based
- tanstack-router-react-example-quickstart-webpack-file-based
- router-monorepo-react-query
- router-mono-simple
- router-mono-simple-lazy
- tanstack-router-react-example-scroll-restoration
- tanstack-search-validator-adapters
- tanstack-start-example-bare
- tanstack-start-example-basic
- tanstack-start-example-basic-auth
- tanstack-start-example-basic-cloudflare
- tanstack-start-example-basic-react-query
- tanstack-start-example-basic-static
- tanstack-start-bun-hosting
- tanstack-start-example-convex-trellaux
- tanstack-start-example-counter
- tanstack-start-i18n-paraglide
- tanstack-start-example-large
- tanstack-start-example-material-ui
- tanstack-start-streaming-data-from-server-functions
- tanstack-start-example-supabase-basic
- tanstack-start-tailwind-v4
- tanstack-start-example-trellaux
- tanstack-start-example-workos
- tanstack-router-react-example-view-transitions
- tanstack-router-react-example-with-framer-motion
- tanstack-router-react-example-with-trpc
- tanstack-router-react-example-with-trpc-react-query
@tanstack/arktype-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@5520@tanstack/directive-functions-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/directive-functions-plugin@5520@tanstack/eslint-plugin-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/eslint-plugin-router@5520@tanstack/history
npm i https://pkg.pr.new/TanStack/router/@tanstack/history@5520@tanstack/nitro-v2-vite-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/nitro-v2-vite-plugin@5520@tanstack/react-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router@5520@tanstack/react-router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-devtools@5520@tanstack/react-router-ssr-query
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-router-ssr-query@5520@tanstack/react-start
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@5520@tanstack/react-start-client
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@5520@tanstack/react-start-server
npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@5520@tanstack/router-cli
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-cli@5520@tanstack/router-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-core@5520@tanstack/router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools@5520@tanstack/router-devtools-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-devtools-core@5520@tanstack/router-generator
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-generator@5520@tanstack/router-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-plugin@5520@tanstack/router-ssr-query-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-ssr-query-core@5520@tanstack/router-utils
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-utils@5520@tanstack/router-vite-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/router-vite-plugin@5520@tanstack/server-functions-plugin
npm i https://pkg.pr.new/TanStack/router/@tanstack/server-functions-plugin@5520@tanstack/solid-router
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router@5520@tanstack/solid-router-devtools
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-router-devtools@5520@tanstack/solid-start
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@5520@tanstack/solid-start-client
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@5520@tanstack/solid-start-server
npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@5520@tanstack/start-client-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@5520@tanstack/start-plugin-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@5520@tanstack/start-server-core
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@5520@tanstack/start-static-server-functions
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-static-server-functions@5520@tanstack/start-storage-context
npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@5520@tanstack/valibot-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@5520@tanstack/virtual-file-routes
npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@5520@tanstack/zod-adapter
npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@5520commit:
f535282Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between 7d8e105c1f02e416ccb3821c8e59c83bf7c46bb6 and f535282c8d8792267e2e13763f614560bbb5ffe9.
📒 Files selected for processing (2)
packages/server-functions-plugin/src/index.ts(1 hunks)packages/start-server-core/src/fake-start-server-fn-manifest.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript in strict mode with extensive type safety across the codebase
Files:
packages/start-server-core/src/fake-start-server-fn-manifest.tspackages/server-functions-plugin/src/index.ts
packages/{*-start,start-*}/**
📄 CodeRabbit inference engine (AGENTS.md)
Name and place Start framework packages under packages/-start/ or packages/start-/
Files:
packages/start-server-core/src/fake-start-server-fn-manifest.ts
🧬 Code graph analysis (2)
packages/start-server-core/src/fake-start-server-fn-manifest.ts (1)
packages/start-server-core/src/getServerFnById.ts (1)
getServerFnById(1-1)
packages/server-functions-plugin/src/index.ts (1)
packages/directive-functions-plugin/src/compilers.ts (1)
GenerateFunctionIdFn(26-30)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Preview
- GitHub Check: Test
🔇 Additional comments (3)
packages/server-functions-plugin/src/index.ts (3)
71-76: LGTM! Clean helper for path normalization.The
withTrailingSlashhelper correctly ensures a trailing slash on paths, which is essential for consistent path prefix matching on different platforms.
96-96: Correct application of normalized path.Using the computed
filevalue instead ofextractedFilenameensures the server function receives the properly normalized path with the/@idprefix for module resolution.
83-91: Verify path normalization handles Windows edge cases.The path normalization logic looks sound—using
withTrailingSlash(root)for the prefix check while slicing byroot.length(without trailing slash) correctly preserves the leading slash. However, please verify:- Edge case: If
extractedFilenameequalsrootexactly,filebecomes empty and line 90 produces"/@id/". Confirm this is handled appropriately. - Windows paths: Ensure that both
serverDevEnv.config.rootandextractedFilenameare normalized to forward slashes by Vite before this code runs, as mixing backslashes and forward slashes would break thestartsWithcheck.
packages/start-server-core/src/fake-start-server-fn-manifest.ts line 1@@ -1 +1 @@1-export function getServerFnById() {}1+export async function getServerFnById(): Promise<any> {}⚠️ Potential issue | 🔴 Critical
Missing required parameter in function signature.
The fake implementation is missing the
idparameter that the real implementation includes (seepackages/server-functions-plugin/src/index.tslines 191 and 211). Even though this is a stub, the signature should match to maintain type consistency and prevent runtime errors if this fake is accidentally invoked.Apply this diff to fix the signature:
-export async function getServerFnById(): Promise<any> {} +export async function getServerFnById(id: string): Promise<any> {}Additionally, consider tightening the return type from
Promise<any>to be more specific if the actual return type is known.📝 Committable suggestion
‼️ IMPORTANT Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
export async function getServerFnById(id: string): Promise<any> {}🤖 Prompt for AI Agents
In packages/start-server-core/src/fake-start-server-fn-manifest.ts around line 1, the exported async function is missing the required id parameter present in the real implementation; update the function signature to accept the same id parameter (and any other parameters that the real implementation defines at lines 191 and 211 in packages/server-functions-plugin/src/index.ts) so the stub matches the real API, and tighten the return type from Promise<any> to the actual return type if known (or to a more specific union/interface) to maintain type consistency and avoid runtime/typing surprises.
Sign in to join this conversation.
Walkthrough#
Server function ID generation in dev environments now normalizes trailing slashes via a helper function and adjusts file path computation to construct routes with leading slash prefixes. Concurrently, the fake manifest's
getServerFnByIdfunction transitions from synchronous to asynchronous with a Promise return type.Changes#
packages/server-functions-plugin/src/index.tswithTrailingSlash()helper for trailing slash normalization; updatesgenerateFunctionIdto compute root fromserverDevEnv.config.root, strip root prefix from filename, and construct file path with leading slash (e.g.,/@id...); updatesserverFn.fileaccordinglypackages/start-server-core/src/fake-start-server-fn-manifest.tsgetServerFnByIdfrom synchronous to asynchronous, updating signature toexport async function getServerFnById(): Promise<any> {}Estimated code review effort#
🎯 2 (Simple) | ⏱️ ~15 minutes
Possibly related PRs#
Poem#
Pre-merge checks and finishing touches#
❌ Failed checks (1 warning)
@coderabbitai generate docstringsto improve docstring coverage.✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment `@coderabbitai help` to get the list of available commands and usage tips.