Skip to content

fix(expo): fix Android new architecture codegen error in NativeClerkModule#8112

Open
chriscanin wants to merge 5 commits intomainfrom
chris/fix-native-clerk-module-codegen
Open

fix(expo): fix Android new architecture codegen error in NativeClerkModule#8112
chriscanin wants to merge 5 commits intomainfrom
chris/fix-native-clerk-module-codegen

Conversation

@chriscanin
Copy link
Member

@chriscanin chriscanin commented Mar 18, 2026

Summary

PR #8066 fixed a web crash by adding optional chaining to `TurboModuleRegistry?.get` in `NativeClerkModule.ts`. However, React Native's new architecture codegen requires the exact pattern `TurboModuleRegistry.get('moduleName')` — the `?.` breaks its parser with `UnusedModuleInterfaceParserError`.

  • Restores `TurboModuleRegistry.get('ClerkExpo')` in `NativeClerkModule.ts` (fixes Android codegen)
  • Adds `NativeClerkModule.web.ts` that exports `null` (Metro resolves this on web, avoiding the `TurboModuleRegistry` undefined crash)

Reported by

Bledar (internal) — Android build failure with `UnusedModuleInterfaceParserError: Module NativeClerkModule: Unused NativeModule spec`

Test plan

  • Android new architecture build succeeds (no `generateCodegenSchemaFromJavaScript` failure)
  • Web build still works without `Cannot read properties of undefined (reading 'get')` crash

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Resolved Android new architecture codegen errors to restore stable native module resolution and prevent runtime failures.
    • Restored the native module registry pattern to ensure reliable module lookup across Android builds.
    • Added explicit web-side handling to avoid native registry references on web, improving cross-platform compatibility.

@changeset-bot
Copy link

changeset-bot bot commented Mar 18, 2026

🦋 Changeset detected

Latest commit: 93d8593

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

This PR includes changesets to release 1 package
Name Type
@clerk/expo 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

@github-actions github-actions bot added the expo label Mar 18, 2026
@vercel
Copy link

vercel bot commented Mar 18, 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 Mar 23, 2026 3:48pm

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

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

Review profile: ASSERTIVE

Plan: Pro

Run ID: f2505740-14ba-4c3b-ab91-5d3bf33fed28

📥 Commits

Reviewing files that changed from the base of the PR and between b00c2ed and 93d8593.

📒 Files selected for processing (1)
  • packages/expo/src/specs/NativeClerkModule.web.ts

📝 Walkthrough

Walkthrough

The PR updates the Expo NativeClerkModule specifications: packages/expo/src/specs/NativeClerkModule.ts now exports the result of TurboModuleRegistry.get<Spec>('ClerkExpo') directly (removing optional chaining and null coalescing). A new web-specific file packages/expo/src/specs/NativeClerkModule.web.ts is added and exports null as the default to avoid referencing TurboModuleRegistry on web. A patch-level changeset entry is included.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title directly and specifically addresses the main change: fixing Android new architecture codegen errors in NativeClerkModule by restoring the TurboModuleRegistry.get pattern.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@chriscanin chriscanin self-assigned this Mar 18, 2026
Copy link
Member

@brkalow brkalow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did/can we verify the web case is still fixed?

@chriscanin
Copy link
Member Author

chriscanin commented Mar 23, 2026

did/can we verify the web case is still fixed?

I have just verified, web is working as well! Sign-ins and sign-outs are working.
image

Copy link
Member

@tmilewski tmilewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Seems to fail when building in CI though.

@chriscanin
Copy link
Member Author

👍 Seems to fail when building in CI though.

Yeah checking this out. I think it was passing on Friday. Not sure... Fixing it up.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Mar 23, 2026

Open in StackBlitz

@clerk/agent-toolkit

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

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 93d8593

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants