Skip to content

Comments

fix(react): Export named deriveFromSsrInitialState not found#7902

Open
tmilewski wants to merge 2 commits intomainfrom
tom/derive-state
Open

fix(react): Export named deriveFromSsrInitialState not found#7902
tmilewski wants to merge 2 commits intomainfrom
tom/derive-state

Conversation

@tmilewski
Copy link
Member

@tmilewski tmilewski commented Feb 22, 2026

Description

Fix SyntaxError: Export named 'deriveFromSsrInitialState' not found in module '/var/task/node_modules/@clerk/shared/dist/runtime/deriveState.mjs'.
    at <parse> (:0)
    at link (native:1:11)
    at linkAndEvaluateModule (native:1:11)
    at requestImportModule (native:2)
    at processTicksAndRejections (native:7:39) {
  cause: SyntaxError: Export named 'deriveFromSsrInitialState' not found in module '/var/task/nodex_modules/@clerk/shared/dist/runtime/deriveState.mjs'.
      at <parse> (:0)
      at link (native:1:11)
      at linkAndEvaluateModule (native:1:11)
      at requestImportModule (native:2)
      at processTicksAndRejections (native:7:39),
  status: 500,
  statusText: undefined,
  headers: undefined,
  data: undefined,
  body: undefined,
  unhandled: true
}

Behavior is unchanged; only the way the shared package is used is simplified and no longer relies on the internal named exports that were missing in your runtime.

Cause:

The error happens when the app (e.g. on Vercel) loads @clerk/shared/dist/runtime/deriveState.mjs. That file re-exports from an internal chunk (e.g. deriveState-xxxxxx.mjs). In some environments or with different build/publish setups, the named exports deriveFromSsrInitialState and deriveFromClientSideState can end up missing from the resolved module, which triggers the “Export named 'deriveFromSsrInitialState' not found” error.

Fix:

useAuthBase was updated to use only the public deriveState API from @clerk/shared/deriveState instead of the internal helpers, so the hook no longer depends on those named exports.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • Refactor

    • Consolidated auth state derivation into a single shared implementation, improving consistency between server-rendered and client-rendered authentication state and across integrations.
  • Chores

    • Recorded a patch release entry noting the unified derive behavior for auth state to align releases and changelogs.

@tmilewski tmilewski self-assigned this Feb 22, 2026
@changeset-bot
Copy link

changeset-bot bot commented Feb 22, 2026

🦋 Changeset detected

Latest commit: 3185683

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

This PR includes changesets to release 6 packages
Name Type
@clerk/react Patch
@clerk/chrome-extension Patch
@clerk/expo Patch
@clerk/nextjs Patch
@clerk/react-router Patch
@clerk/tanstack-react-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

@vercel
Copy link

vercel bot commented Feb 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Feb 22, 2026 7:04pm

Request Review

@tmilewski tmilewski changed the title fix: deriveState fix(react): deriveState Feb 22, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 22, 2026

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7902

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7902

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7902

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7902

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7902

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7902

@clerk/expo

npm i https://pkg.pr.new/@clerk/expo@7902

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7902

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7902

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7902

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@7902

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7902

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7902

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7902

@clerk/react

npm i https://pkg.pr.new/@clerk/react@7902

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7902

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7902

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7902

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7902

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@7902

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7902

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7902

commit: 3185683

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 22, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

This change consolidates two derive utilities into a single deriveState API within useAuthBase.tsx. The initial-state and non-initial code paths now call deriveState with different argument configurations instead of using deriveFromClientSideState and deriveFromSsrInitialState. Imports were updated to bring in deriveState and the DeriveStateReturnType type from @clerk/shared/deriveState. No public API signatures were modified. Lines changed: +4/-3.

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title references a specific error ('Export named deriveFromSsrInitialState not found') but the actual fix removes the use of these exports entirely, replacing them with deriveState API calls. The title describes the symptom/error but is misleading about the actual solution implemented. Update the title to reflect the actual change: something like 'fix(react): Replace internal deriveState helpers with public deriveState API in useAuthBase' would accurately describe what was changed.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@tmilewski tmilewski changed the title fix(react): deriveState fix(react): Export named 'deriveFromSsrInitialState' not found Feb 22, 2026
@tmilewski tmilewski changed the title fix(react): Export named 'deriveFromSsrInitialState' not found fix(react): Export named deriveFromSsrInitialState not found Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants