Build fails on RN 0.76.7 + Sentry 6.14.0 (New Architecture) — Unsupported type: StringLiteralUnionTypeAnnotation
What React Native libraries do you use?
React Native without Frameworks, RN New Architecture, Hermes
Are you using sentry.io or on-premise?
sentry.io (SaS)
@sentry/react-native SDK Version
6.14.0
How does your development environment look like?
I’m encountering a fatal build error when trying to run my React Native app using React Native v0.76.7, Sentry React Native v6.14.0, and New Architecture enabled.
Environment:
-
React Native version: 0.76.7
-
Sentry React Native version: 6.14.0
-
Node.js version: v22.11.0
-
Gradle: 8.10.2
-
Android Gradle Plugin: 8.6.0
-
New Architecture: ✅ Enabled
-
OS: Windows
Sentry.init()
Sentry.init({
dsn: 'https://[email protected]/...'
// other options
});
Steps to Reproduce
i) Install Sentry React Native v6.14.0
ii) Enable New Architecture in react-native.config.js
iii) Run: npm run android (with react-native run-android)
iv) Observe crash during codegen step
Expected Result
The project builds and runs without errors using the new architecture.
Actual Result
C:\Users\nonr\Desktop\Projects\Freelance\consumer\app\node_modules\react-native\node_modules@react-native\codegen\lib\generators\modules\GenerateModuleH.js:256 throw new Error(createErrorMessage(realTypeAnnotation.type)); ^
Error: Unsupported type for param "type". Found: StringLiteralUnionTypeAnnotation
at translatePrimitiveJSTypeToCpp (C:\Users\nonr\Desktop\Projects\Freelance\consumer\app\node_modules\react-native\node_modules@react-native\codegen\lib\generators\modules\GenerateModuleH.js:256:13)
at getCppType (C:\Users\nonr\Desktop\Projects\Freelance\consumer\app\node_modules\react-native\node_modules@react-native\codegen\lib\generators\modules\GenerateModuleH.js:261:5)
at C:\Users\nonr\Desktop\Projects\Freelance\consumer\app\node_modules\react-native\node_modules@react-native\codegen\lib\generators\modules\GenerateModuleH.js:309:28
at Array.map (
at Array.map (
at Array.flatMap (
Node.js v22.11.0
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':sentry_react-native:generateCodegenArtifactsFromSchema'.
Process 'command 'cmd'' finished with non-zero exit value 1
- Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. Get more help at https://help.gradle.org.
BUILD FAILED in 1m
error Failed to install the app. Command failed with exit code 1: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
C:\Users\nonr\Desktop\Projects\Freelance\consumer\app\node_modules\react-native\node_modules@react-native\codegen\lib\generators\modules\GenerateModuleH.js:256 throw new Error(createErrorMessage(realTypeAnnotation.type)); ^ Error: Unsupported type for param "type". Found: StringLiteralUnionTypeAnnotation at translatePrimitiveJSTypeToCpp (C:\Users\nonr\Desktop\Projects\Freelance\consumer\app\node_modules\react-native\node_modules@react-native\codegen\lib\generators\modules\GenerateModuleH.js:256:13) at getCppType (C:\Users\nonr\Desktop\Projects\Freelance\consumer\app\node_modules\react-native\node_modules@react-native\codegen\lib\generators\modules\GenerateModuleH.js:261:5) at C:\Users\nonr\Desktop\Projects\Freelance\consumer\app\node_modules\react-native\node_modules@react-native\codegen\lib\generators\modules\GenerateModuleH.js:309:28 at Array.map (
Thank you for opening this PR. We will review it and get back to you once our investigation is complete.
Thank you for opening this PR. We will review it and get back to you once our investigation is complete.
Update: I tried using versions 6.12 and 6.10 as well, but the same error persists. The error goes away if I disable the new architecture, but that significantly reduces the app’s performance.
Would you mind sharing your react-native.config.js ? also does it crash when you enable the new architecture on `gradle.properties`?
Closing this due to lack of response. Feel free to comment with answers or updated information and we will reopen if it's actionable.