Skip to content

fix(start): hash server function paths relative to the root - #2387

Open
jchatard wants to merge 1 commit into
solidjs:mainfrom
jchatard:fix/server-function-ids-relative-path
Open

jchatard wants to merge 1 commit into
solidjs:mainfrom
jchatard:fix/server-function-ids-relative-path

Conversation

@jchatard

Copy link
Copy Markdown
Contributor

Fixes #2386.

Server function ids started with xxHash32 of the module's absolute path, so the same code built in two directories got different ids. Machines that each build one deploy in their own directory then served different client chunks, even with the same skewProtection.buildId: a page rendered by one machine called another with ids it did not know (500 invalid server function), and most of its _build/assets URLs were 404 there.

The ids now hash the module path relative to the Vite root, with / separators so Windows builds match too. The dev lookup (solid-start:server-fn-lookup) uses the same hash to find the module. compile() takes the hash from the plugin and keeps hashing id when it is called on its own.

Tests

  • New case in directives/index.spec.ts: the same file under two roots compiles to the same client code, and a different file still gets a different id. It fails without the change.
  • pnpm typecheck, pnpm format:check, and the @solidjs/start Vitest suite (324 tests) pass.
  • Checked on a real app with the same change as a patch on 2.2.3: two builds of one commit in different directories produce byte-identical .output/public (391 files), and each server runs the other build's server function calls.

Ids change once for every app: a page loaded before upgrading gets 409 on its next call if skewProtection is on, as with any deploy.

@netlify

netlify Bot commented Nov 26, 2026

Copy link
Copy Markdown

👷 Deploy request for solid-start-landing-page pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit c9fe688

@changeset-bot

changeset-bot Bot commented Nov 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c9fe688

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solidjs/start Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Nov 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@solidjs/start@2387

commit: c9fe688

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server function IDs depend on the absolute build path, so skewProtection.buildId does not work across machines

2 participants