Skip to content

fix(expo): Resolve config-plugins through the expo package - #6581

Merged
lucas-zimerman merged 5 commits into
mainfrom
alwx/fix/6564
Aug 10, 2026
Merged

fix(expo): Resolve config-plugins through the expo package#6581
lucas-zimerman merged 5 commits into
mainfrom
alwx/fix/6564

Conversation

@alwx

@alwx alwx commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

withSentryAndroidGradlePlugin was the only one of the four Expo config plugin files importing the bare @expo/config-plugins; the other three use the expo/config-plugins sub-export. It now uses the sub-export too.

expo/config-plugins.js is a plain re-export (module.exports = require('@expo/config-plugins')), so this is a module-resolution fix only, with no behavioural change.

The test now mocks the same specifier the source imports. Previously it mocked @expo/config-plugins, which passes under either import because of the re-export chain, so it could not catch a regression.

💡 Motivation and Context

Fixes #6564.

@expo/config-plugins is not declared in @sentry/react-native's package.json as a dependency, peer dependency or optional dependency, so the bare specifier resolved only when some other package happened to hoist it to the project root — true on Expo SDK 57 (via expo, expo-sharing, expo-splash-screen), false on SDK 56. Where it was not hoisted, expo config, expo-doctor and expo prebuild failed with Cannot find module '@expo/config-plugins', so EAS builds died before any native compilation.

withSentry.ts requires the module eagerly at load time, so the failure was not gated on experimental_android.enableAndroidGradlePlugin being enabled.

💚 How did you test it?

  • yarn jest test/expo-plugin — 67 tests pass.
  • tsc -p plugin/tsconfig.json clean, and the emitted plugin/build/*.js now contains four identical require("expo/config-plugins") calls instead of three plus one bare require("@expo/config-plugins").
  • Not reproduced end-to-end in an Expo SDK 56 CNG project without hoisting; the fix rests on the specifier plus the contents of expo/config-plugins.js.

📝 Checklist

  • I added tests to verify changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.
  • No breaking changes.

🔮 Next steps

All four plugin files import ExpoConfig from @expo/config-types, which is also undeclared. Harmless at runtime (type-only, erased on compile), but the reference survives into the generated .d.ts. Not addressed here.

test/expo-plugin/modifyMainApplication.test.ts and modifyAppDelegate.test.ts still mock @expo/config-plugins while their sources import expo/config-plugins. Works through the re-export, same inconsistency, left alone.

alwx added 2 commits August 10, 2026 13:52
withSentryAndroidGradlePlugin was the only plugin file requiring the bare
@expo/config-plugins, which is not declared as a dependency, peer dependency
or optional dependency of @sentry/react-native. It resolved only when another
package happened to hoist it to the project root — true on Expo SDK 57 via
expo/expo-sharing/expo-splash-screen, false on SDK 56 — so expo config,
expo-doctor and expo prebuild crashed before any native compilation.

withSentry.js requires the module eagerly, so the failure was not gated on
experimental_android.enableAndroidGradlePlugin being enabled.

expo/config-plugins is a plain re-export (module.exports =
require('@expo/config-plugins')), so this is resolution-only, with no
behavioural change. The test now mocks the same specifier the source imports,
so a regression back to the bare package fails instead of resolving through
the re-export.

Fixes #6564
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • fix(expo): Resolve config-plugins through the expo package by alwx in #6581
  • docs: fix dead links in the README by luccasfraga in #6570
  • chore(deps): update Maestro to v2.8.0 by github-actions in #6551
  • chore(deps): update Android SDK to v8.52.0 by github-actions in #6566
  • chore(deps): bump the codeql-action group with 3 updates by dependabot in #6572
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.28.0 to 2.30.0 by dependabot in #6573
  • chore(deps): bump getsentry/craft from 2.28.0 to 2.30.0 by dependabot in #6575
  • chore(deps): bump dorny/paths-filter from 4.0.2 to 4.0.3 by dependabot in #6574
  • chore(deps): bump nanoid from 3.3.8 to 3.3.18 by dependabot in #6579
  • chore(deps): bump gradle/actions/setup-gradle from 6.2.0 to 6.3.0 by dependabot in #6576
  • chore(ci): remove Cirrus runners and use only Bitrise by itaybre in #6563
  • fix(ios): Re-land SentrySDK.internal migration, bump Cocoa SDK to 9.24.0 by alwx in #6541
  • ci: Replace curl-pipe-bash with action-setup-cli for Sentry CLI setup by oioki in #6567

🤖 This preview updates automatically when you update the PR.

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor
Warnings
⚠️

⚠️ Android SDK Version Mismatch

Component Version
sentry-android in build.gradle 8.52.0
sentry-android bundled by gradle plugin 6.17.0 8.51.0

If a user enables AGP autoInstallation (default: true), this mismatch causes:

IllegalStateException: Sentry SDK has detected a mix of versions

Our docs instruct React Native users to set autoInstallation.enabled = false, so users following the guide are unaffected. Consider either updating packages/core/android/build.gradle to 8.51.0 or waiting for a gradle plugin release that bundles 8.52.0.

Generated by 🚫 dangerJS against 5673278

@alwx
alwx marked this pull request as ready for review August 10, 2026 12:04

@lucas-zimerman lucas-zimerman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

@lucas-zimerman lucas-zimerman added the ready-to-merge Triggers the full CI test suite label Aug 10, 2026
@lucas-zimerman

lucas-zimerman commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Warnings
⚠️

⚠️ Android SDK Version Mismatch

Component Version
sentry-android in build.gradle 8.52.0
sentry-android bundled by gradle plugin 6.17.0 8.51.0

If a user enables AGP autoInstallation (default: true), this mismatch causes:

IllegalStateException: Sentry SDK has detected a mix of versions

Our docs instruct React Native users to set autoInstallation.enabled = false, so users following the guide are unaffected. Consider either updating packages/core/android/build.gradle to 8.51.0 or waiting for a gradle plugin release that bundles 8.52.0.

Generated by 🚫 dangerJS against 5673278

@alwx might be worth fixing this before shipping a new release, it's unrelated to this PR so it might have slipped into main..

@sentry

sentry Bot commented Aug 10, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
Sentry RN io.sentry.reactnative.sample 8.22.0 (102) Release

⚙️ sentry-react-native Build Distribution Settings

@github-actions

Copy link
Copy Markdown
Contributor

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3851.62 ms 1229.40 ms -2622.23 ms
Size 5.08 MiB 6.72 MiB 1.64 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
5fe1c6c+dirty 1220.79 ms 1217.63 ms -3.16 ms
0a147b2+dirty 3838.15 ms 1221.94 ms -2616.21 ms
41d6254+dirty 3845.71 ms 1224.51 ms -2621.20 ms
a636fa4+dirty 3852.48 ms 1236.10 ms -2616.38 ms
1a2e7e0+dirty 3842.49 ms 1220.04 ms -2622.45 ms
3d377b5+dirty 1218.48 ms 1219.51 ms 1.03 ms
4bb93c7+dirty 3845.98 ms 1218.02 ms -2627.96 ms
bbb8d67+dirty 3838.98 ms 1217.84 ms -2621.14 ms
ab203f9+dirty 3848.07 ms 1219.71 ms -2628.35 ms
7436d0f+dirty 3851.58 ms 1232.21 ms -2619.38 ms

App size

Revision Plain With Sentry Diff
5fe1c6c+dirty 3.38 MiB 4.77 MiB 1.39 MiB
0a147b2+dirty 4.98 MiB 6.51 MiB 1.53 MiB
41d6254+dirty 5.15 MiB 6.70 MiB 1.54 MiB
a636fa4+dirty 4.98 MiB 6.55 MiB 1.57 MiB
1a2e7e0+dirty 4.98 MiB 6.46 MiB 1.49 MiB
3d377b5+dirty 3.38 MiB 4.76 MiB 1.38 MiB
4bb93c7+dirty 5.08 MiB 6.68 MiB 1.60 MiB
bbb8d67+dirty 4.98 MiB 6.55 MiB 1.57 MiB
ab203f9+dirty 4.98 MiB 6.51 MiB 1.53 MiB
7436d0f+dirty 5.15 MiB 6.70 MiB 1.54 MiB

@github-actions

Copy link
Copy Markdown
Contributor

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3838.76 ms 1218.23 ms -2620.53 ms
Size 5.08 MiB 6.72 MiB 1.64 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
7a89652+dirty 3827.11 ms 1211.49 ms -2615.62 ms
0a147b2+dirty 3845.11 ms 1230.81 ms -2614.30 ms
5b7e8a7+dirty 3855.46 ms 1234.47 ms -2620.99 ms
5fe1c6c+dirty 1201.36 ms 1209.15 ms 7.78 ms
580fb5c+dirty 3835.45 ms 1218.61 ms -2616.84 ms
94af3bd+dirty 3847.84 ms 1230.33 ms -2617.51 ms
f3215d3+dirty 3846.08 ms 1231.85 ms -2614.23 ms
a636fa4+dirty 3846.16 ms 1210.10 ms -2636.05 ms
5a21b51+dirty 3837.87 ms 1223.47 ms -2614.40 ms
4bb93c7+dirty 3869.22 ms 1230.76 ms -2638.47 ms

App size

Revision Plain With Sentry Diff
7a89652+dirty 5.15 MiB 6.70 MiB 1.55 MiB
0a147b2+dirty 4.98 MiB 6.51 MiB 1.53 MiB
5b7e8a7+dirty 5.15 MiB 6.70 MiB 1.54 MiB
5fe1c6c+dirty 3.38 MiB 4.77 MiB 1.39 MiB
580fb5c+dirty 4.98 MiB 6.46 MiB 1.48 MiB
94af3bd+dirty 5.15 MiB 6.69 MiB 1.53 MiB
f3215d3+dirty 5.15 MiB 6.67 MiB 1.52 MiB
a636fa4+dirty 4.98 MiB 6.55 MiB 1.57 MiB
5a21b51+dirty 5.15 MiB 6.67 MiB 1.51 MiB
4bb93c7+dirty 5.08 MiB 6.68 MiB 1.60 MiB

@lucas-zimerman
lucas-zimerman merged commit 4340ac1 into main Aug 10, 2026
86 of 89 checks passed
@lucas-zimerman
lucas-zimerman deleted the alwx/fix/6564 branch August 10, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Triggers the full CI test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

withSentryAndroidGradlePlugin.js imports @expo/config-plugins instead of the expo/config-plugins sub-export

2 participants