Skip to content

Conversation

@nikosdouvlis
Copy link
Member

@nikosdouvlis nikosdouvlis commented Jan 14, 2026

Description

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

  • New Features

    • satelliteAutoSync option to control automatic handshake for satellite apps (default: enabled).
    • New __clerk_sync parameter and CLERK_SYNC_STATUS (NeedsSync/Completed) to coordinate cross-domain sign‑in flow.
    • Middleware options may be provided as a function (resolved per request) for dynamic configuration.
    • Redirect APIs accept an isSatellite flag to preserve satellite-aware redirect behavior.
  • Chores

    • Legacy __clerk_synced marked deprecated; explicit sync-status constants exposed publicly.
  • Tests

    • Updated/added tests covering handshake, sync triggers, and loop protection.

✏️ Tip: You can customize this high-level summary in your review settings.

…dshake

Why:
Satellite apps currently trigger a handshake redirect on every first page load,
even when no cookies exist. This creates unnecessary redirects to the primary
domain for apps where most users aren't authenticated.

What changed:
- Added `satelliteAutoSync` option (default: true) to AuthenticateRequestOptions
- Added ClerkSyncStatus enum with NeedsSync ('1') and Completed ('2') values
- When satelliteAutoSync=false, skip handshake if no cookies and no sync trigger
- Use __clerk_sync=1 to trigger handshake after explicit sign-in action
- Use __clerk_sync=2 to prevent sync loops (overwrites NeedsSync using set())
- Backwards compatible: still reads legacy __clerk_synced=true param
…rk-js

Why:
Clerk-js needs shared constants and type definitions for the new satellite
sync optimization feature to coordinate handshake flows on the client side.

What changed:
- Added CLERK_SYNC constant and CLERK_SYNC_STATUS enum to internal constants
- Added CLERK_SYNC to valid query params list for proper cleanup
- Added satelliteAutoSync option to ClerkOptions type with callback support
- Deprecated legacy CLERK_SYNCED constant in favor of new unified param
Why:
Client-side rendering needs to respect the satelliteAutoSync option to avoid
unnecessary redirects when loading satellite apps in the browser.

What changed:
- buildSignInUrl/buildSignUpUrl add __clerk_sync=1 param for satellite redirects
- #shouldSyncWithPrimary checks satelliteAutoSync option via handleValueOrFn
- #redirectToSatellite uses __clerk_sync=2 instead of legacy __clerk_synced
- #clearClerkQueryParams removes new CLERK_SYNC param
- Backwards compat: still reads legacy __clerk_synced=true param
Why:
TanStack React Start applications need to pass the satelliteAutoSync option
through to the backend to control satellite handshake behavior.

What changed:
- Added satelliteAutoSync option to ClerkMiddlewareOptions type
- loadOptions processes satelliteAutoSync using handleValueOrFn for callback support
- Option is passed through to authenticateRequest
@changeset-bot
Copy link

changeset-bot bot commented Jan 14, 2026

🦋 Changeset detected

Latest commit: 77bec92

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

This PR includes changesets to release 20 packages
Name Type
@clerk/backend Minor
@clerk/shared Minor
@clerk/clerk-js Minor
@clerk/tanstack-react-start Minor
@clerk/nextjs Patch
@clerk/astro Patch
@clerk/agent-toolkit Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/testing Patch
@clerk/chrome-extension Patch
@clerk/expo-passkeys Patch
@clerk/expo Patch
@clerk/localizations Patch
@clerk/msw Patch
@clerk/react Patch
@clerk/ui Patch
@clerk/vue 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 Jan 14, 2026

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

Project Deployment Review Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Jan 14, 2026 10:27pm

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 14, 2026

Open in StackBlitz

@clerk/agent-toolkit

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

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 77bec92

@nikosdouvlis
Copy link
Member Author

!snapshot

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 14, 2026

📝 Walkthrough

Walkthrough

Adds multi‑domain synchronization using a new query parameter `__clerk_sync` with statuses `ClerkSyncStatus.NeedsSync = '1'` and `ClerkSyncStatus.Completed = '2'`, and a deprecated alias `__clerk_synced`. Introduces `satelliteAutoSync?: boolean` (default true) on public options and callbacks. Updates token/request handling, handshake and redirect logic, createRedirect signatures, client helpers, shared constants and query-param types, middleware/type signatures, loader options, and tests to support the new sync statuses and guards.

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
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.
Title check ❓ Inconclusive The title 'Improve satellite flows' is vague and generic, using non-descriptive phrasing that doesn't convey the specific changes made in this PR. Consider a more specific title that describes the main change, such as 'Add satelliteAutoSync option to control satellite domain synchronization' or 'Introduce __clerk_sync parameter for improved satellite app handshake flow'.
✅ 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.



📜 Recent review details

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 86c951e and 77bec92.

📒 Files selected for processing (6)
  • packages/backend/src/__tests__/createRedirect.test.ts
  • packages/backend/src/constants.ts
  • packages/backend/src/createRedirect.ts
  • packages/backend/src/tokens/__tests__/request.test.ts
  • packages/backend/src/tokens/request.ts
  • packages/tanstack-react-start/src/server/types.ts
🧰 Additional context used
📓 Path-based instructions (13)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

All code must pass ESLint checks with the project's configuration

Files:

  • packages/backend/src/tokens/request.ts
  • packages/tanstack-react-start/src/server/types.ts
  • packages/backend/src/__tests__/createRedirect.test.ts
  • packages/backend/src/createRedirect.ts
  • packages/backend/src/constants.ts
  • packages/backend/src/tokens/__tests__/request.test.ts
**/*.{js,jsx,ts,tsx,json,md,yml,yaml}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • packages/backend/src/tokens/request.ts
  • packages/tanstack-react-start/src/server/types.ts
  • packages/backend/src/__tests__/createRedirect.test.ts
  • packages/backend/src/createRedirect.ts
  • packages/backend/src/constants.ts
  • packages/backend/src/tokens/__tests__/request.test.ts
packages/**/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/backend/src/tokens/request.ts
  • packages/tanstack-react-start/src/server/types.ts
  • packages/backend/src/__tests__/createRedirect.test.ts
  • packages/backend/src/createRedirect.ts
  • packages/backend/src/constants.ts
  • packages/backend/src/tokens/__tests__/request.test.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Follow established naming conventions (PascalCase for components, camelCase for variables)

Files:

  • packages/backend/src/tokens/request.ts
  • packages/tanstack-react-start/src/server/types.ts
  • packages/backend/src/__tests__/createRedirect.test.ts
  • packages/backend/src/createRedirect.ts
  • packages/backend/src/constants.ts
  • packages/backend/src/tokens/__tests__/request.test.ts
packages/**/src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

packages/**/src/**/*.{ts,tsx,js,jsx}: Maintain comprehensive JSDoc comments for public APIs
Use tree-shaking friendly exports
Validate all inputs and sanitize outputs
All public APIs must be documented with JSDoc
Use dynamic imports for optional features
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Implement proper logging with different levels

Files:

  • packages/backend/src/tokens/request.ts
  • packages/tanstack-react-start/src/server/types.ts
  • packages/backend/src/__tests__/createRedirect.test.ts
  • packages/backend/src/createRedirect.ts
  • packages/backend/src/constants.ts
  • packages/backend/src/tokens/__tests__/request.test.ts
**/*.ts?(x)

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

Files:

  • packages/backend/src/tokens/request.ts
  • packages/tanstack-react-start/src/server/types.ts
  • packages/backend/src/__tests__/createRedirect.test.ts
  • packages/backend/src/createRedirect.ts
  • packages/backend/src/constants.ts
  • packages/backend/src/tokens/__tests__/request.test.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)

**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Implement type guards for unknown types using the pattern function isType(value: unknown): value is Type
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details in classes
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Use mixins for shared behavior across unrelated classes in TypeScript
Use generic constraints with bounded type parameters like <T extends { id: string }>
Use utility types like Omit, Partial, and Pick for data transformation instead of manual type construction
Use discriminated unions instead of boolean flags for state management and API responses
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation at the type level
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Document functions with JSDoc comments including @param, @returns, @throws, and @example tags
Create custom error classes that extend Error for specific error types
Use the Result pattern for error handling instead of throwing exceptions
Use optional chaining (?.) and nullish coalescing (??) operators for safe property access
Let TypeScript infer obvious types to reduce verbosity
Use const assertions with as const for literal types
Use satisfies operator for type checking without widening types
Declare readonly arrays and objects for immutable data structures
Use spread operator and array spread for immutable updates instead of mutations
Use lazy loading for large types...

Files:

  • packages/backend/src/tokens/request.ts
  • packages/tanstack-react-start/src/server/types.ts
  • packages/backend/src/__tests__/createRedirect.test.ts
  • packages/backend/src/createRedirect.ts
  • packages/backend/src/constants.ts
  • packages/backend/src/tokens/__tests__/request.test.ts
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Use ESLint with custom configurations tailored for different package types

Files:

  • packages/backend/src/tokens/request.ts
  • packages/tanstack-react-start/src/server/types.ts
  • packages/backend/src/__tests__/createRedirect.test.ts
  • packages/backend/src/createRedirect.ts
  • packages/backend/src/constants.ts
  • packages/backend/src/tokens/__tests__/request.test.ts
**/*.{js,ts,jsx,tsx,json,md,yml,yaml}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Use Prettier for code formatting across all packages

Files:

  • packages/backend/src/tokens/request.ts
  • packages/tanstack-react-start/src/server/types.ts
  • packages/backend/src/__tests__/createRedirect.test.ts
  • packages/backend/src/createRedirect.ts
  • packages/backend/src/constants.ts
  • packages/backend/src/tokens/__tests__/request.test.ts
**/*

⚙️ CodeRabbit configuration file

If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.

**/*: Only comment on issues that would block merging, ignore minor or stylistic concerns.
Restrict feedback to errors, security risks, or functionality-breaking problems.
Do not post comments on code style, formatting, or non-critical improvements.
Keep reviews short: flag only issues that make the PR unsafe to merge.
Group similar issues into a single comment instead of posting multiple notes.
Skip repetition: if a pattern repeats, mention it once at a summary level only.
Do not add general suggestions, focus strictly on merge-blocking concerns.
If there are no critical problems, respond with minimal approval (e.g., 'Looks good'). Do not add additional review.
Avoid line-by-line commentary unless it highlights a critical bug or security hole.
Highlight only issues that could cause runtime errors, data loss, or severe maintainability issues.
Ignore minor optimization opportunities, focus solely on correctness and safety.
Provide a top-level summary of critical blockers rather than detailed per-line notes.
Comment only when the issue must be resolved before merge, otherwise remain silent.
When in doubt, err on the side of fewer comments, brevity and blocking issues only.
Avoid posting any refactoring issues.

Files:

  • packages/backend/src/tokens/request.ts
  • packages/tanstack-react-start/src/server/types.ts
  • packages/backend/src/__tests__/createRedirect.test.ts
  • packages/backend/src/createRedirect.ts
  • packages/backend/src/constants.ts
  • packages/backend/src/tokens/__tests__/request.test.ts
**/*.{test,spec}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

**/*.{test,spec}.{ts,tsx,js,jsx}: Unit tests are required for all new functionality
Verify proper error handling and edge cases
Include tests for all new features

Files:

  • packages/backend/src/__tests__/createRedirect.test.ts
  • packages/backend/src/tokens/__tests__/request.test.ts
**/*.{test,spec,e2e}.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Use real Clerk instances for integration tests

Files:

  • packages/backend/src/__tests__/createRedirect.test.ts
  • packages/backend/src/tokens/__tests__/request.test.ts
**/*.test.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Use React Testing Library for component testing

Files:

  • packages/backend/src/__tests__/createRedirect.test.ts
  • packages/backend/src/tokens/__tests__/request.test.ts
🧬 Code graph analysis (3)
packages/backend/src/__tests__/createRedirect.test.ts (1)
packages/backend/src/createRedirect.ts (1)
  • createRedirect (89-149)
packages/backend/src/createRedirect.ts (2)
packages/backend/src/constants.ts (2)
  • constants (91-98)
  • ClerkSyncStatus (81-86)
packages/nextjs/src/server/utils.ts (1)
  • redirectAdapter (141-143)
packages/backend/src/tokens/__tests__/request.test.ts (2)
packages/backend/src/tokens/request.ts (1)
  • authenticateRequest (147-862)
packages/backend/src/tokens/authStatus.ts (2)
  • AuthErrorReason (105-122)
  • AuthErrorReason (124-124)
⏰ 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). (25)
  • GitHub Check: Integration Tests (nextjs, chrome, 16, RQ)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (nextjs, chrome, 16)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome, 16)
  • GitHub Check: Integration Tests (quickstart, chrome, 15)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Integration Tests (custom, chrome)
  • GitHub Check: Integration Tests (machine, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (machine, chrome, RQ)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (billing, chrome, RQ)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Integration Tests (handshake:staging, chrome)
  • GitHub Check: Integration Tests (handshake, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (sessions:staging, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (10)
packages/backend/src/constants.ts (1)

77-98: LGTM!

The new ClerkSyncStatus constant is well-documented with JSDoc comments explaining the sync semantics. The string values 'false' and 'true' align with the commit message indicating alignment with FAPI's __clerk_synced=true response format.

packages/tanstack-react-start/src/server/types.ts (1)

11-49: LGTM!

The satelliteAutoSync option has comprehensive JSDoc documentation explaining its default behavior and performance implications. The new ClerkMiddlewareOptionsCallback type enables dynamic configuration based on request context, which is a clean pattern for middleware options.

packages/backend/src/createRedirect.ts (2)

23-31: LGTM!

The logic correctly sets the ClerkSynced parameter to NeedsSync on the returnBackUrl only when both conditions are met: cross-origin redirect AND satellite app. This ensures the handshake flow is triggered when users return from primary sign-in, which is the intended behavior for multi-domain satellite flows.


89-146: LGTM!

The isSatellite parameter is correctly threaded through all redirect paths (redirectToTasks, redirectToSignIn, redirectToSignUp) and passed to buildUrl. The implementation maintains backward compatibility since isSatellite is optional.

packages/backend/src/tokens/request.ts (2)

469-507: LGTM!

The multi-domain sync flow logic is well-structured:

  1. Derives sync state from the __clerk_synced query parameter
  2. shouldSkipSatelliteHandshake correctly gates on satelliteAutoSync === false (explicit opt-out)
  3. Falls through to normal token verification when cookies exist, enabling refresh flows
  4. The JSDoc comments clearly explain the sync semantics

559-564: Correct use of set() to prevent duplicate parameters.

Using set() instead of append() ensures that any existing __clerk_synced=false value is overwritten with true, preventing sync loops and duplicate query parameters in the redirect URL.

packages/backend/src/tokens/__tests__/request.test.ts (2)

793-869: LGTM!

Good test coverage for the satelliteAutoSync flows:

  • Verifies signed-out state without handshake redirect when satelliteAutoSync=false and no cookies
  • Confirms handshake triggers when __clerk_synced=false is present even with satelliteAutoSync=false
  • Tests completion state with __clerk_synced=true

918-943: LGTM!

This test correctly validates that the primary domain overwrites __clerk_synced=false with __clerk_synced=true (rather than appending), preventing sync loops and duplicate query parameters in the redirect URL.

packages/backend/src/__tests__/createRedirect.test.ts (2)

102-120: LGTM!

Test correctly verifies that satellite apps get __clerk_synced=false appended to the returnBackUrl during cross-origin redirect. The encoded URL expectation is accurate.


122-140: LGTM!

Test correctly verifies that non-satellite apps do not receive the __clerk_synced parameter, maintaining backward compatibility.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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

@clerk-cookie
Copy link
Collaborator

Hey @nikosdouvlis - the snapshot version command generated the following package versions:

Package Version
@clerk/agent-toolkit 0.2.9-snapshot.v20260114095952
@clerk/astro 3.0.0-snapshot.v20260114095952
@clerk/backend 3.0.0-snapshot.v20260114095952
@clerk/chrome-extension 3.0.0-snapshot.v20260114095952
@clerk/clerk-js 6.0.0-snapshot.v20260114095952
@clerk/dev-cli 1.0.0-snapshot.v20260114095952
@clerk/expo 3.0.0-snapshot.v20260114095952
@clerk/expo-passkeys 1.0.0-snapshot.v20260114095952
@clerk/express 2.0.0-snapshot.v20260114095952
@clerk/fastify 2.6.9-snapshot.v20260114095952
@clerk/localizations 4.0.0-snapshot.v20260114095952
@clerk/msw 0.0.1-snapshot.v20260114095952
@clerk/nextjs 7.0.0-snapshot.v20260114095952
@clerk/nuxt 2.0.0-snapshot.v20260114095952
@clerk/react 6.0.0-snapshot.v20260114095952
@clerk/react-router 3.0.0-snapshot.v20260114095952
@clerk/shared 4.0.0-snapshot.v20260114095952
@clerk/tanstack-react-start 1.0.0-snapshot.v20260114095952
@clerk/testing 2.0.0-snapshot.v20260114095952
@clerk/ui 1.0.0-snapshot.v20260114095952
@clerk/upgrade 2.0.0-snapshot.v20260114095952
@clerk/vue 2.0.0-snapshot.v20260114095952

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/agent-toolkit

npm i @clerk/[email protected] --save-exact

@clerk/astro

npm i @clerk/[email protected] --save-exact

@clerk/backend

npm i @clerk/[email protected] --save-exact

@clerk/chrome-extension

npm i @clerk/[email protected] --save-exact

@clerk/clerk-js

npm i @clerk/[email protected] --save-exact

@clerk/dev-cli

npm i @clerk/[email protected] --save-exact

@clerk/expo

npm i @clerk/[email protected] --save-exact

@clerk/expo-passkeys

npm i @clerk/[email protected] --save-exact

@clerk/express

npm i @clerk/[email protected] --save-exact

@clerk/fastify

npm i @clerk/[email protected] --save-exact

@clerk/localizations

npm i @clerk/[email protected] --save-exact

@clerk/msw

npm i @clerk/[email protected] --save-exact

@clerk/nextjs

npm i @clerk/[email protected] --save-exact

@clerk/nuxt

npm i @clerk/[email protected] --save-exact

@clerk/react

npm i @clerk/[email protected] --save-exact

@clerk/react-router

npm i @clerk/[email protected] --save-exact

@clerk/shared

npm i @clerk/[email protected] --save-exact

@clerk/tanstack-react-start

npm i @clerk/[email protected] --save-exact

@clerk/testing

npm i @clerk/[email protected] --save-exact

@clerk/ui

npm i @clerk/[email protected] --save-exact

@clerk/upgrade

npm i @clerk/[email protected] --save-exact

@clerk/vue

npm i @clerk/[email protected] --save-exact

Why:
Integration tests needed to verify the satelliteAutoSync feature works
correctly in a real Next.js middleware environment.

What changed:
- Updated test middleware to accept X-Satellite-Auto-Sync header
- Added test: satelliteAutoSync=false skips handshake with no cookies
- Added test: __clerk_sync=1 triggers handshake even with satelliteAutoSync=false
- Added test: __clerk_sync=2 (completed) prevents re-sync loop
- Added test: satelliteAutoSync=true (default) triggers handshake
Added examples for SSR (Next.js, TanStack Start), CSR (ClerkProvider),
and dynamic callback usage.
…options

Why:
Allows dynamic configuration based on the request URL, matching the
pattern used in Next.js middleware.

What changed:
- Added ClerkMiddlewareOptionsCallback type
- clerkMiddleware now accepts options OR a callback function
- Callback receives URL and returns options (sync or async)
@nikosdouvlis
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

Hey @nikosdouvlis - the snapshot version command generated the following package versions:

Package Version
@clerk/agent-toolkit 0.2.9-snapshot.v20260114114137
@clerk/astro 3.0.0-snapshot.v20260114114137
@clerk/backend 3.0.0-snapshot.v20260114114137
@clerk/chrome-extension 3.0.0-snapshot.v20260114114137
@clerk/clerk-js 6.0.0-snapshot.v20260114114137
@clerk/dev-cli 1.0.0-snapshot.v20260114114137
@clerk/expo 3.0.0-snapshot.v20260114114137
@clerk/expo-passkeys 1.0.0-snapshot.v20260114114137
@clerk/express 2.0.0-snapshot.v20260114114137
@clerk/fastify 2.6.9-snapshot.v20260114114137
@clerk/localizations 4.0.0-snapshot.v20260114114137
@clerk/msw 0.0.1-snapshot.v20260114114137
@clerk/nextjs 7.0.0-snapshot.v20260114114137
@clerk/nuxt 2.0.0-snapshot.v20260114114137
@clerk/react 6.0.0-snapshot.v20260114114137
@clerk/react-router 3.0.0-snapshot.v20260114114137
@clerk/shared 4.0.0-snapshot.v20260114114137
@clerk/tanstack-react-start 1.0.0-snapshot.v20260114114137
@clerk/testing 2.0.0-snapshot.v20260114114137
@clerk/ui 1.0.0-snapshot.v20260114114137
@clerk/upgrade 2.0.0-snapshot.v20260114114137
@clerk/vue 2.0.0-snapshot.v20260114114137

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/agent-toolkit

npm i @clerk/[email protected] --save-exact

@clerk/astro

npm i @clerk/[email protected] --save-exact

@clerk/backend

npm i @clerk/[email protected] --save-exact

@clerk/chrome-extension

npm i @clerk/[email protected] --save-exact

@clerk/clerk-js

npm i @clerk/[email protected] --save-exact

@clerk/dev-cli

npm i @clerk/[email protected] --save-exact

@clerk/expo

npm i @clerk/[email protected] --save-exact

@clerk/expo-passkeys

npm i @clerk/[email protected] --save-exact

@clerk/express

npm i @clerk/[email protected] --save-exact

@clerk/fastify

npm i @clerk/[email protected] --save-exact

@clerk/localizations

npm i @clerk/[email protected] --save-exact

@clerk/msw

npm i @clerk/[email protected] --save-exact

@clerk/nextjs

npm i @clerk/[email protected] --save-exact

@clerk/nuxt

npm i @clerk/[email protected] --save-exact

@clerk/react

npm i @clerk/[email protected] --save-exact

@clerk/react-router

npm i @clerk/[email protected] --save-exact

@clerk/shared

npm i @clerk/[email protected] --save-exact

@clerk/tanstack-react-start

npm i @clerk/[email protected] --save-exact

@clerk/testing

npm i @clerk/[email protected] --save-exact

@clerk/ui

npm i @clerk/[email protected] --save-exact

@clerk/upgrade

npm i @clerk/[email protected] --save-exact

@clerk/vue

npm i @clerk/[email protected] --save-exact

Changed callback signature from `(url) => options` to `({ url }) => options`
for future extensibility.
@nikosdouvlis
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

Hey @nikosdouvlis - the snapshot version command generated the following package versions:

Package Version
@clerk/agent-toolkit 0.2.9-snapshot.v20260114114652
@clerk/astro 3.0.0-snapshot.v20260114114652
@clerk/backend 3.0.0-snapshot.v20260114114652
@clerk/chrome-extension 3.0.0-snapshot.v20260114114652
@clerk/clerk-js 6.0.0-snapshot.v20260114114652
@clerk/dev-cli 1.0.0-snapshot.v20260114114652
@clerk/expo 3.0.0-snapshot.v20260114114652
@clerk/expo-passkeys 1.0.0-snapshot.v20260114114652
@clerk/express 2.0.0-snapshot.v20260114114652
@clerk/fastify 2.6.9-snapshot.v20260114114652
@clerk/localizations 4.0.0-snapshot.v20260114114652
@clerk/msw 0.0.1-snapshot.v20260114114652
@clerk/nextjs 7.0.0-snapshot.v20260114114652
@clerk/nuxt 2.0.0-snapshot.v20260114114652
@clerk/react 6.0.0-snapshot.v20260114114652
@clerk/react-router 3.0.0-snapshot.v20260114114652
@clerk/shared 4.0.0-snapshot.v20260114114652
@clerk/tanstack-react-start 1.0.0-snapshot.v20260114114652
@clerk/testing 2.0.0-snapshot.v20260114114652
@clerk/ui 1.0.0-snapshot.v20260114114652
@clerk/upgrade 2.0.0-snapshot.v20260114114652
@clerk/vue 2.0.0-snapshot.v20260114114652

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/agent-toolkit

npm i @clerk/[email protected] --save-exact

@clerk/astro

npm i @clerk/[email protected] --save-exact

@clerk/backend

npm i @clerk/[email protected] --save-exact

@clerk/chrome-extension

npm i @clerk/[email protected] --save-exact

@clerk/clerk-js

npm i @clerk/[email protected] --save-exact

@clerk/dev-cli

npm i @clerk/[email protected] --save-exact

@clerk/expo

npm i @clerk/[email protected] --save-exact

@clerk/expo-passkeys

npm i @clerk/[email protected] --save-exact

@clerk/express

npm i @clerk/[email protected] --save-exact

@clerk/fastify

npm i @clerk/[email protected] --save-exact

@clerk/localizations

npm i @clerk/[email protected] --save-exact

@clerk/msw

npm i @clerk/[email protected] --save-exact

@clerk/nextjs

npm i @clerk/[email protected] --save-exact

@clerk/nuxt

npm i @clerk/[email protected] --save-exact

@clerk/react

npm i @clerk/[email protected] --save-exact

@clerk/react-router

npm i @clerk/[email protected] --save-exact

@clerk/shared

npm i @clerk/[email protected] --save-exact

@clerk/tanstack-react-start

npm i @clerk/[email protected] --save-exact

@clerk/testing

npm i @clerk/[email protected] --save-exact

@clerk/ui

npm i @clerk/[email protected] --save-exact

@clerk/upgrade

npm i @clerk/[email protected] --save-exact

@clerk/vue

npm i @clerk/[email protected] --save-exact

Since clerkMiddleware now accepts a callback function for dynamic options,
individual props no longer need to be callbacks. This simplifies the API.

What changed:
- Use MultiDomainAndOrProxyPrimitives instead of MultiDomainAndOrProxy
- Remove handleValueOrFn usage from loadOptions
- satelliteAutoSync is now just boolean (not callback)
- domain, isSatellite, proxyUrl are now just primitives
…ellites

Why:
Server-side redirects (redirectToSignIn from middleware) weren't adding
__clerk_sync=1 to the return URL for satellite apps. This broke the
satellite → sign-in → primary → handshake flow when using SSR redirects,
causing users to remain signed out on satellite domains.

What changed:
- Added isSatellite param to createRedirect in @clerk/backend
- Pass isSatellite to createRedirect in nextjs and astro middleware
- When satellite + cross-origin redirect, adds __clerk_sync=1 to returnBackUrl
- Added tests for satellite sync param behavior
@nikosdouvlis
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

Hey @nikosdouvlis - the snapshot version command generated the following package versions:

Package Version
@clerk/agent-toolkit 0.2.9-snapshot.v20260114124449
@clerk/astro 3.0.0-snapshot.v20260114124449
@clerk/backend 3.0.0-snapshot.v20260114124449
@clerk/chrome-extension 3.0.0-snapshot.v20260114124449
@clerk/clerk-js 6.0.0-snapshot.v20260114124449
@clerk/dev-cli 1.0.0-snapshot.v20260114124449
@clerk/expo 3.0.0-snapshot.v20260114124449
@clerk/expo-passkeys 1.0.0-snapshot.v20260114124449
@clerk/express 2.0.0-snapshot.v20260114124449
@clerk/fastify 2.6.9-snapshot.v20260114124449
@clerk/localizations 4.0.0-snapshot.v20260114124449
@clerk/msw 0.0.1-snapshot.v20260114124449
@clerk/nextjs 7.0.0-snapshot.v20260114124449
@clerk/nuxt 2.0.0-snapshot.v20260114124449
@clerk/react 6.0.0-snapshot.v20260114124449
@clerk/react-router 3.0.0-snapshot.v20260114124449
@clerk/shared 4.0.0-snapshot.v20260114124449
@clerk/tanstack-react-start 1.0.0-snapshot.v20260114124449
@clerk/testing 2.0.0-snapshot.v20260114124449
@clerk/ui 1.0.0-snapshot.v20260114124449
@clerk/upgrade 2.0.0-snapshot.v20260114124449
@clerk/vue 2.0.0-snapshot.v20260114124449

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/agent-toolkit

npm i @clerk/[email protected] --save-exact

@clerk/astro

npm i @clerk/[email protected] --save-exact

@clerk/backend

npm i @clerk/[email protected] --save-exact

@clerk/chrome-extension

npm i @clerk/[email protected] --save-exact

@clerk/clerk-js

npm i @clerk/[email protected] --save-exact

@clerk/dev-cli

npm i @clerk/[email protected] --save-exact

@clerk/expo

npm i @clerk/[email protected] --save-exact

@clerk/expo-passkeys

npm i @clerk/[email protected] --save-exact

@clerk/express

npm i @clerk/[email protected] --save-exact

@clerk/fastify

npm i @clerk/[email protected] --save-exact

@clerk/localizations

npm i @clerk/[email protected] --save-exact

@clerk/msw

npm i @clerk/[email protected] --save-exact

@clerk/nextjs

npm i @clerk/[email protected] --save-exact

@clerk/nuxt

npm i @clerk/[email protected] --save-exact

@clerk/react

npm i @clerk/[email protected] --save-exact

@clerk/react-router

npm i @clerk/[email protected] --save-exact

@clerk/shared

npm i @clerk/[email protected] --save-exact

@clerk/tanstack-react-start

npm i @clerk/[email protected] --save-exact

@clerk/testing

npm i @clerk/[email protected] --save-exact

@clerk/ui

npm i @clerk/[email protected] --save-exact

@clerk/upgrade

npm i @clerk/[email protected] --save-exact

@clerk/vue

npm i @clerk/[email protected] --save-exact

…ectUrl for satellites

Why:
Client-side redirects using forceRedirectUrl or fallbackRedirectUrl props
(e.g., SignInButton with forceRedirectUrl) were not adding __clerk_sync=1
to the return URL. This caused the handshake to not trigger when returning
from primary sign-in, leaving users signed out on satellite domains.

What changed:
- Added #addSyncTriggerToRedirectOptions helper that processes all redirect
  URL variants (signInForceRedirectUrl, signInFallbackRedirectUrl, etc.)
- buildSignInUrl and buildSignUpUrl now apply sync trigger to all redirect
  options, not just the default redirectUrl
@nikosdouvlis
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

Hey @nikosdouvlis - the snapshot version command generated the following package versions:

Package Version
@clerk/agent-toolkit 0.2.9-snapshot.v20260114130428
@clerk/astro 3.0.0-snapshot.v20260114130428
@clerk/backend 3.0.0-snapshot.v20260114130428
@clerk/chrome-extension 3.0.0-snapshot.v20260114130428
@clerk/clerk-js 6.0.0-snapshot.v20260114130428
@clerk/dev-cli 1.0.0-snapshot.v20260114130428
@clerk/expo 3.0.0-snapshot.v20260114130428
@clerk/expo-passkeys 1.0.0-snapshot.v20260114130428
@clerk/express 2.0.0-snapshot.v20260114130428
@clerk/fastify 2.6.9-snapshot.v20260114130428
@clerk/localizations 4.0.0-snapshot.v20260114130428
@clerk/msw 0.0.1-snapshot.v20260114130428
@clerk/nextjs 7.0.0-snapshot.v20260114130428
@clerk/nuxt 2.0.0-snapshot.v20260114130428
@clerk/react 6.0.0-snapshot.v20260114130428
@clerk/react-router 3.0.0-snapshot.v20260114130428
@clerk/shared 4.0.0-snapshot.v20260114130428
@clerk/tanstack-react-start 1.0.0-snapshot.v20260114130428
@clerk/testing 2.0.0-snapshot.v20260114130428
@clerk/ui 1.0.0-snapshot.v20260114130428
@clerk/upgrade 2.0.0-snapshot.v20260114130428
@clerk/vue 2.0.0-snapshot.v20260114130428

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/agent-toolkit

npm i @clerk/[email protected] --save-exact

@clerk/astro

npm i @clerk/[email protected] --save-exact

@clerk/backend

npm i @clerk/[email protected] --save-exact

@clerk/chrome-extension

npm i @clerk/[email protected] --save-exact

@clerk/clerk-js

npm i @clerk/[email protected] --save-exact

@clerk/dev-cli

npm i @clerk/[email protected] --save-exact

@clerk/expo

npm i @clerk/[email protected] --save-exact

@clerk/expo-passkeys

npm i @clerk/[email protected] --save-exact

@clerk/express

npm i @clerk/[email protected] --save-exact

@clerk/fastify

npm i @clerk/[email protected] --save-exact

@clerk/localizations

npm i @clerk/[email protected] --save-exact

@clerk/msw

npm i @clerk/[email protected] --save-exact

@clerk/nextjs

npm i @clerk/[email protected] --save-exact

@clerk/nuxt

npm i @clerk/[email protected] --save-exact

@clerk/react

npm i @clerk/[email protected] --save-exact

@clerk/react-router

npm i @clerk/[email protected] --save-exact

@clerk/shared

npm i @clerk/[email protected] --save-exact

@clerk/tanstack-react-start

npm i @clerk/[email protected] --save-exact

@clerk/testing

npm i @clerk/[email protected] --save-exact

@clerk/ui

npm i @clerk/[email protected] --save-exact

@clerk/upgrade

npm i @clerk/[email protected] --save-exact

@clerk/vue

npm i @clerk/[email protected] --save-exact

Replace __clerk_sync with __clerk_synced using false/true values:
- __clerk_synced=false triggers sync (was __clerk_sync=1)
- __clerk_synced=true means completed (was __clerk_sync=2)

FAPI already returns __clerk_synced=true, so this unifies on a single param.
@nikosdouvlis
Copy link
Member Author

!snapshot

@clerk-cookie
Copy link
Collaborator

Hey @nikosdouvlis - the snapshot version command generated the following package versions:

Package Version
@clerk/agent-toolkit 0.2.9-snapshot.v20260114225347
@clerk/astro 3.0.0-snapshot.v20260114225347
@clerk/backend 3.0.0-snapshot.v20260114225347
@clerk/chrome-extension 3.0.0-snapshot.v20260114225347
@clerk/clerk-js 6.0.0-snapshot.v20260114225347
@clerk/dev-cli 1.0.0-snapshot.v20260114225347
@clerk/expo 3.0.0-snapshot.v20260114225347
@clerk/expo-passkeys 1.0.0-snapshot.v20260114225347
@clerk/express 2.0.0-snapshot.v20260114225347
@clerk/fastify 2.6.9-snapshot.v20260114225347
@clerk/localizations 4.0.0-snapshot.v20260114225347
@clerk/msw 0.0.1-snapshot.v20260114225347
@clerk/nextjs 7.0.0-snapshot.v20260114225347
@clerk/nuxt 2.0.0-snapshot.v20260114225347
@clerk/react 6.0.0-snapshot.v20260114225347
@clerk/react-router 3.0.0-snapshot.v20260114225347
@clerk/shared 4.0.0-snapshot.v20260114225347
@clerk/tanstack-react-start 1.0.0-snapshot.v20260114225347
@clerk/testing 2.0.0-snapshot.v20260114225347
@clerk/ui 1.0.0-snapshot.v20260114225347
@clerk/upgrade 2.0.0-snapshot.v20260114225347
@clerk/vue 2.0.0-snapshot.v20260114225347

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/agent-toolkit

npm i @clerk/[email protected] --save-exact

@clerk/astro

npm i @clerk/[email protected] --save-exact

@clerk/backend

npm i @clerk/[email protected] --save-exact

@clerk/chrome-extension

npm i @clerk/[email protected] --save-exact

@clerk/clerk-js

npm i @clerk/[email protected] --save-exact

@clerk/dev-cli

npm i @clerk/[email protected] --save-exact

@clerk/expo

npm i @clerk/[email protected] --save-exact

@clerk/expo-passkeys

npm i @clerk/[email protected] --save-exact

@clerk/express

npm i @clerk/[email protected] --save-exact

@clerk/fastify

npm i @clerk/[email protected] --save-exact

@clerk/localizations

npm i @clerk/[email protected] --save-exact

@clerk/msw

npm i @clerk/[email protected] --save-exact

@clerk/nextjs

npm i @clerk/[email protected] --save-exact

@clerk/nuxt

npm i @clerk/[email protected] --save-exact

@clerk/react

npm i @clerk/[email protected] --save-exact

@clerk/react-router

npm i @clerk/[email protected] --save-exact

@clerk/shared

npm i @clerk/[email protected] --save-exact

@clerk/tanstack-react-start

npm i @clerk/[email protected] --save-exact

@clerk/testing

npm i @clerk/[email protected] --save-exact

@clerk/ui

npm i @clerk/[email protected] --save-exact

@clerk/upgrade

npm i @clerk/[email protected] --save-exact

@clerk/vue

npm i @clerk/[email protected] --save-exact

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.

3 participants