Skip to content

fix(expo): show a clear error when the native build doesn't match @clerk/expo - #11011

Merged
wobsoriano merged 5 commits into
mainfrom
rob/mobile-729-bridge-version-mismatch
Nov 25, 2026
Merged

wobsoriano merged 5 commits into
mainfrom
rob/mobile-729-bridge-version-mismatch

Conversation

@wobsoriano

@wobsoriano wobsoriano commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Description

When an app's native build doesn't match @clerk/expo, the native components render blank. @clerk/expo only noticed when a native method was missing, and logged it only in development. So a release build that got a newer @clerk/expo through an over-the-air update failed silently. A method that kept its name but changed its arguments wasn't caught at all.

The native module in @clerk/expo-native-components now exports a bridgeVersion constant, and @clerk/expo checks it against the version it expects. On a mismatch it disables native components and logs an error in every build that names the @clerk/expo version and tells you to update both packages together and rebuild. Native builds from before this change don't export the constant, so they count as version 1 when they have the current methods. The next change to the contract between the two packages bumps the number on both sides, and the native contract test fails if Swift, Kotlin and @clerk/expo disagree.

Clerk: Native components are disabled because this app's native build doesn't match @clerk/expo 4.17.6 (native bridge version 2, expected 1). Update @clerk/expo and @clerk/expo-native-components together to their latest versions, then rebuild the app.

The screenshots are development builds with a local patch, not committed, that stands in for the next contract change. It adds an argument to the native configureNative and sets bridgeVersion to 2 on both builds. Before, @clerk/expo only logs a Metro warning that configuring native failed (Received 3 arguments, but 4 was expected) and the sign-in view is empty. After, the app shows the error. Device e2e also passed on iOS and Android with no patch.

BeforeAfter
iOS home
iOS sign-in
Android home
Android sign-in

Fixes MOBILE-729.

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:

🤖 Generated with Claude under Rob's supervision.

@vercel

vercel Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Nov 25, 2026 9:03pm UTC
swingset Ready Ready Preview Nov 25, 2026 9:03pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
mosaic-docs Skipped Skipped Nov 25, 2026 9:03pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Android and iOS native modules expose bridge version 1, and the Expo package defines the expected version. The native module loader checks the version and required methods. Incompatible modules produce an error with version details and update or rebuild instructions. Tests cover the native version declaration and loader behavior. A changeset declares patch releases for both Expo packages.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Severity of issue fixed: Medium

Suggested reviewers: mikepitre, seanperez29

Merge Risk: Minimal · up to cb6df

This change adds a native bridge version check between the Expo packages and logs a clear error when the builds are incompatible. Legacy native builds that have the current methods still work. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: when the native build does not match @clerk/expo, the user now gets a clear error. The changeset adds a bridge-version check that disables native components and logs a…
Description check Passed The description explains the problem: native components render blank when the native build and @clerk/expo do not match, and the old check ran only in development. It describes the new bridgeVersion c…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: when the native build does not match @clerk/expo, the user now gets a clear error. The changeset adds a bridge-version check that disables native components and logs an error in every build, which matches the title's scope. The title uses the conventional fix(expo) prefix and stays under one line.

Full details: Description check

Explanation

The description explains the problem: native components render blank when the native build and @clerk/expo do not match, and the old check ran only in development. It describes the new bridgeVersion constant, the mismatch error, the backward-compatible version 1 handling, and the contract test. It also includes screenshots and test notes, so it is clearly related to the changeset.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

CI annotation context is incomplete: annotation collection unavailable or limited

Linked repositories: This review skipped 6 repositories. Cross-repository analysis may be incomplete. Check linked repository access and settings.

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between bf3a2d4 and cb6dfbc.

Files selected for processing: 2

  • packages/expo/src/utils/__tests__/native-module.test.ts
  • packages/expo/src/utils/native-module.ts
Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. 3 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.

Finishing Touches
Fix failing CI checks

  • Commit to this branch
  • Create a new PR

@changeset-bot

changeset-bot Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: cb6dfbc

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

This PR includes changesets to release 2 packages
Name Type
@clerk/expo Patch
@clerk/expo-native-components 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 25, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@11011

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@11011

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@11011

@clerk/expo

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

@clerk/expo-biometrics

npm i https://pkg.pr.new/@clerk/expo-biometrics@11011

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@11011

@clerk/expo-native-components

npm i https://pkg.pr.new/@clerk/expo-native-components@11011

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/mosaic

npm i https://pkg.pr.new/@clerk/mosaic@11011

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: cb6dfbc

@blacksmith-sh

blacksmith-sh Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Matches Version-2 native build is disabled with a clear error

Head returned null and logged the error naming @clerk/expo 4.17.6, native version 2 vs expected 1, and the update-both-and-rebuild step; base had accepted it silently.

Merge-base

bridgeVersion 2 accepted

This PR cb6dfbcd

bridgeVersion 2 rejected

Also checked · 5 match · 1 not run

Blocked Mismatched native build on a device shows the error · Blocked
Matches Mismatch error is logged in release builds too
Matches Older native builds without bridgeVersion still work
Matches No native module stays silent
Matches Swift and Kotlin export the bridge version @clerk/expo expects
Matches Matching version with missing methods says methods are missing

Note

Proof planned 1 claim but was not able to run it:

Needs an iOS simulator (macOS only) or an Android emulator with the Android SDK, neither available in this Linux sandbox

  • Mismatched native build on a device shows the error

Proof on cb6dfbcd (from bf3a2d42) · mocked: @clerk/expo native module loader (No iOS or Android device in this Linux sandbox; a fake native module object is f...) · not run: expo-native test app (iOS needs macOS; no Android SDK or emulator in the sandbox) · Did Proof get it right? Yes · No

View full Proof report · React 👎 or comment @codesmith dismiss this proof to dismiss

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

API Changes Report

Generated by Break Check on 2026-11-25T21:05:49.532Z

Summary

Metric Count
Packages analyzed 20
Packages with changes 0
🔴 Breaking changes 0
🟡 Non-breaking changes 0
🟢 Additions 0

No API Changes Detected

All packages have stable APIs with no detected changes.


Report generated by Break Check

Last ran on cb6dfbc.

@wobsoriano
wobsoriano enabled auto-merge (squash) November 25, 2026 21:09
@wobsoriano
wobsoriano merged commit 4ad596b into main Nov 25, 2026
103 of 104 checks passed
@wobsoriano
wobsoriano deleted the rob/mobile-729-bridge-version-mismatch branch November 25, 2026 21:25

This branch was successfully deployed

2 active deployments
Preview – swingset — cb6dfbcd Deployed Nov 25, 2026 by vercel[bot]
Preview – clerk-js-sandbox — cb6dfbcd Deployed Nov 25, 2026 by vercel[bot]
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