sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

Build fails on RN 0.76.7 + Sentry 6.14.0 (New Architecture) — Unsupported type: StringLiteralUnionTypeAnnotation

Open mohib-uddin opened this issue 6 months ago • 3 comments

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 C:\Users\nonr\Desktop\Projects\Freelance\consumer\app\node_modules\react-native\node_modules@react-native\codegen\lib\generators\modules\GenerateModuleH.js:308:10
at Array.map () at createStructsString (C:\Users\nonr\Desktop\Projects\Freelance\consumer\app\node_modules\react-native\node_modules@react-native\codegen\lib\generators\modules\GenerateModuleH.js:271:6) at C:\Users\nonr\Desktop\Projects\Freelance\consumer\app\node_modules\react-native\node_modules@react-native\codegen\lib\generators\modules\GenerateModuleH.js:593:23
at Array.flatMap () at generate (C:\Users\nonr\Desktop\Projects\Freelance\consumer\app\node_modules\react-native\node_modules@react-native\codegen\lib\generators\modules\GenerateModuleH.js:586:48)

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 () at C:\Users\nonr\Desktop\Projects\Freelance\consumer\app\node_modules\react-native\node_modules@react-native\codegen\lib\generators\modules\GenerateModuleH.js:308:10 at Array.map () at createStructsString (C:\Users\nonr\Desktop\Projects\Freelance\consumer\app\node_modules\react-native\node_modules@react-native\codegen\lib\generators\modules\GenerateModuleH.js:271:6) at C:\Users\nonr\Desktop\Projects\Freelance\consumer\app\node_modules\react-native\node_modules@react-native\codegen\lib\generators\modules\GenerateModuleH.js:593:23 at Array.flatMap () at generate (C:\Users\nonr\Desktop\Projects\Freelance\consumer\app\node_modules\react-native\node_modules@react-native\codegen\lib\generators\modules\GenerateModuleH.js:586:48) 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. info Run CLI with --verbose flag for more details. PS C:\Users\nonr\Desktop\Projects\Freelance\consumer\app>

mohib-uddin avatar May 28 '25 16:05 mohib-uddin

Thank you for opening this PR. We will review it and get back to you once our investigation is complete.

lucas-zimerman avatar May 30 '25 09:05 lucas-zimerman

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.

mohib-uddin avatar May 30 '25 10:05 mohib-uddin

Would you mind sharing your react-native.config.js ? also does it crash when you enable the new architecture on `gradle.properties`?

lucas-zimerman avatar May 30 '25 19:05 lucas-zimerman

Closing this due to lack of response. Feel free to comment with answers or updated information and we will reopen if it's actionable.

kahest avatar Jun 27 '25 11:06 kahest