Repository navigation
Description
Which project does this relate to?
Start
Describe the bug
A small TanStack Start SSR app builds successfully but returns HTTP 500 on every
request when installed with pnpm's default symlinked node_modules layout. The
emitted .output/server/_ssr/ssr.mjs invokes createServerFn before its
assignment:
TypeError: createServerFn is not a function
at .output/server/_ssr/ssr.mjs:40:18
The same source and exact dependency versions return HTTP 200 when installed
with a hoisted layout. The trigger is importing a Drizzle pgTable schema into
the server-function/query graph. Removing that schema import also makes the
symlinked build work.
The divergence begins in Nitro's intermediate Vite build:
| Install | Layout | HTTP | Intermediate SSR entry | Final ssr.mjs |
|---|---|---|---|---|
pnpm install |
symlinked | 500 | 247.04 kB | 242.49 kB |
pnpm install --config.node-linker=hoisted |
hoisted | 200 | 66.89 kB | 64.72 kB |
This was independently controlled with Bun as well: Bun's isolated layout has
the same failure and its hoisted layout succeeds. Because pnpm reproduces the
failure without Bun, the behavior follows the dependency layout and appears to
be in the TanStack Start / Nitro bundling pipeline.
Complete minimal reproducer
The repository contains no application code, credentials, or private
dependencies. A database is not required; the module fails during SSR startup
before the sample database URL can be used.
Steps to reproduce
git clone https://github.com/astelmach20/tanstack-start-symlink-layout-repro.git
cd tanstack-start-symlink-layout-repro
corepack enable
pnpm install --frozen-lockfile
pnpm build
pnpm preview
curl -i http://127.0.0.1:4173/The build exits 0, then the request returns HTTP 500 with
createServerFn is not a function.
Hoisted control from a second clean clone:
pnpm install --frozen-lockfile --config.node-linker=hoisted
pnpm build
pnpm preview --port 4174
curl -i http://127.0.0.1:4174/This returns HTTP 200.
Expected behavior
The generated SSR bundle should preserve module initialization order under
pnpm's supported default layout, or the build should fail instead of emitting a
bundle that cannot serve a request.
Platform
@tanstack/react-start: 1.168.28@tanstack/react-router: 1.170.18@tanstack/react-router-ssr-query: 1.167.1@tanstack/react-query: 5.101.2nitro: 3.0.260610-betavite: 8.1.5drizzle-orm: 0.45.2postgres: 3.4.9react/react-dom: 19.2.7- pnpm: 10.17.1
- Node: 23.7.0
- OS: macOS arm64; the equivalent isolated-layout failure was also observed in
a Linux serverless runtime - Bundler: Vite / Nitro (node-server preset)
Additional context
- Possibly related: Start + Nitro on Vite 8.2: SSR service chunk re-exports an undeclared namespace (
ssr_exports) → every request 500s whilevite buildexits 0 #8031 and [Bug]:__commonJSMin is not a function— runtime helper lifted into entry chunk again in 1.1.2 (regression of #9224) rolldown/rolldown#9993. This reproduction is much
smaller and specifically isolates dependency layout on Vite 8.1.5. - Independent package-manager controls and analysis:
Bun 1.4 isolated linker breaks TanStack Start SSR when Drizzle schema is imported oven-sh/bun#39963 (comment) - The minimal trigger is
src/schema.tsplus its import insrc/data.ts.
Activity
VSydorenko commentedon Nov 4, 2026
I bisected this using the reproducer linked above. With symlinked pnpm, the result tracks the Rolldown version; Start and Nitro versions do not change it.
createServerFn is not a function@tanstack/react-start+@tanstack/react-routerbumped to 1.169.4 / 1.170.46nitrobumped to 3.0.261103-rcpnpm.overridesRolldown 1.2.6 / 1.2.7 / 1.2.12 / 1.2.13 / 1.2.14 / 1.2.15pnpm.overridesRolldown 1.2.16Each run was
pnpm build, thennode .output/server/index.mjs, thencurl /. Node 24.22.1, pnpm 10.17.1.So, on this reproducer, the bug goes away with Rolldown 1.2.16, released 2026-10-29. I did not bisect commit by commit. These 1.2.16 changes look like the likely fix:
Note that
vite@^8.3.0asks forrolldown ~1.2.6. An existing lockfile can keep an affected 1.2.x patch, so it may be worth pinningrolldown >= 1.2.16until this is confirmed.On current versions, the reproducer itself needs one change:
useSessionis no longer exported from@tanstack/react-start/serverin 1.169.x. I swapped it forgetCookieand kept the same dynamic import. With the report versions, that change does not hide the bug.