fix(ios): resolve relative SOURCEMAP_FILE against project root in Xcode build script#5730
Merged
fix(ios): resolve relative SOURCEMAP_FILE against project root in Xcode build script#5730
Conversation
…de build script When users set SOURCEMAP_FILE to a relative path (e.g. `SOURCEMAP_FILE=maps/main.jsbundle.map`), the value is now resolved against the project root (one level up from `ios/`) rather than against the `ios/` directory where the Xcode build script runs. Without this fix, sentry-cli could not find the source map because the bundle is created relative to the project root. Fixes #3889 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
Contributor
Android (legacy) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| ec14be7+dirty | 403.50 ms | 411.46 ms | 7.96 ms |
| e76d0d3+dirty | 404.18 ms | 411.53 ms | 7.35 ms |
| 785ffb1 | 471.92 ms | 460.96 ms | -10.96 ms |
| ff5a06a+dirty | 405.97 ms | 439.24 ms | 33.27 ms |
| 6416d6c+dirty | 407.30 ms | 422.00 ms | 14.70 ms |
| eec00c2+dirty | 447.08 ms | 469.04 ms | 21.96 ms |
| 7480abe+dirty | 411.60 ms | 405.81 ms | -5.78 ms |
| c08359e | 421.87 ms | 445.37 ms | 23.50 ms |
| 64cd15c | 439.02 ms | 427.63 ms | -11.39 ms |
| af9331b | 449.77 ms | 479.20 ms | 29.43 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| ec14be7+dirty | 17.75 MiB | 19.69 MiB | 1.94 MiB |
| e76d0d3+dirty | 17.75 MiB | 19.71 MiB | 1.96 MiB |
| 785ffb1 | 17.75 MiB | 20.15 MiB | 2.41 MiB |
| ff5a06a+dirty | 43.75 MiB | 48.05 MiB | 4.29 MiB |
| 6416d6c+dirty | 43.75 MiB | 48.05 MiB | 4.30 MiB |
| eec00c2+dirty | 43.75 MiB | 48.05 MiB | 4.29 MiB |
| 7480abe+dirty | 17.75 MiB | 19.68 MiB | 1.94 MiB |
| c08359e | 17.75 MiB | 20.15 MiB | 2.41 MiB |
| 64cd15c | 17.75 MiB | 20.15 MiB | 2.41 MiB |
| af9331b | 17.75 MiB | 19.68 MiB | 1.94 MiB |
Contributor
iOS (legacy) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| ea3e26e+dirty | 1229.13 ms | 1228.46 ms | -0.67 ms |
| 80e4616+dirty | 1221.32 ms | 1225.64 ms | 4.32 ms |
| 818a608+dirty | 1205.76 ms | 1208.00 ms | 2.24 ms |
| 77061ed+dirty | 1233.16 ms | 1234.88 ms | 1.71 ms |
| bef3709+dirty | 1222.07 ms | 1220.24 ms | -1.83 ms |
| a206511+dirty | 1185.00 ms | 1186.35 ms | 1.35 ms |
| 74979ac+dirty | 1210.49 ms | 1213.31 ms | 2.82 ms |
| a2bb688+dirty | 1223.53 ms | 1232.90 ms | 9.37 ms |
| 8a868fe+dirty | 1221.50 ms | 1230.78 ms | 9.28 ms |
| d590428+dirty | 1211.77 ms | 1220.51 ms | 8.75 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| ea3e26e+dirty | 3.41 MiB | 4.58 MiB | 1.17 MiB |
| 80e4616+dirty | 3.38 MiB | 4.60 MiB | 1.22 MiB |
| 818a608+dirty | 2.63 MiB | 3.91 MiB | 1.28 MiB |
| 77061ed+dirty | 2.63 MiB | 3.98 MiB | 1.34 MiB |
| bef3709+dirty | 3.38 MiB | 4.78 MiB | 1.40 MiB |
| a206511+dirty | 3.41 MiB | 4.67 MiB | 1.25 MiB |
| 74979ac+dirty | 3.38 MiB | 4.60 MiB | 1.22 MiB |
| a2bb688+dirty | 2.63 MiB | 3.99 MiB | 1.36 MiB |
| 8a868fe+dirty | 3.38 MiB | 4.60 MiB | 1.22 MiB |
| d590428+dirty | 3.38 MiB | 4.78 MiB | 1.39 MiB |
Contributor
Android (new) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 785ffb1+dirty | 380.65 ms | 451.83 ms | 71.18 ms |
| 59d1977+dirty | 366.15 ms | 393.21 ms | 27.06 ms |
| 95aaf8a+dirty | 342.82 ms | 393.75 ms | 50.93 ms |
| 5ee3314+dirty | 358.69 ms | 394.00 ms | 35.31 ms |
| b1579bc+dirty | 391.87 ms | 456.26 ms | 64.39 ms |
| 4052277+dirty | 369.90 ms | 381.16 ms | 11.26 ms |
| 4a17c8f+dirty | 368.54 ms | 381.43 ms | 12.89 ms |
| eb07ba3+dirty | 419.49 ms | 482.12 ms | 62.63 ms |
| cdf7e97+dirty | 389.79 ms | 418.13 ms | 28.34 ms |
| 93137d1+dirty | 367.58 ms | 434.94 ms | 67.36 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 785ffb1+dirty | 7.15 MiB | 8.42 MiB | 1.27 MiB |
| 59d1977+dirty | 43.94 MiB | 49.22 MiB | 5.29 MiB |
| 95aaf8a+dirty | 7.15 MiB | 8.41 MiB | 1.26 MiB |
| 5ee3314+dirty | 7.15 MiB | 8.43 MiB | 1.28 MiB |
| b1579bc+dirty | 43.94 MiB | 49.27 MiB | 5.33 MiB |
| 4052277+dirty | 43.94 MiB | 49.38 MiB | 5.44 MiB |
| 4a17c8f+dirty | 43.94 MiB | 48.82 MiB | 4.88 MiB |
| eb07ba3+dirty | 7.15 MiB | 8.42 MiB | 1.27 MiB |
| cdf7e97+dirty | 43.94 MiB | 49.22 MiB | 5.29 MiB |
| 93137d1+dirty | 7.15 MiB | 8.43 MiB | 1.28 MiB |
Contributor
iOS (new) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| ea3e26e+dirty | 1216.61 ms | 1214.15 ms | -2.47 ms |
| 80e4616+dirty | 1206.90 ms | 1205.94 ms | -0.96 ms |
| 818a608+dirty | 1218.84 ms | 1223.18 ms | 4.34 ms |
| 77061ed+dirty | 1210.77 ms | 1218.45 ms | 7.68 ms |
| bef3709+dirty | 1217.79 ms | 1225.33 ms | 7.54 ms |
| a206511+dirty | 1225.02 ms | 1223.74 ms | -1.28 ms |
| 74979ac+dirty | 1212.33 ms | 1212.54 ms | 0.21 ms |
| a2bb688+dirty | 1244.82 ms | 1238.60 ms | -6.22 ms |
| 8a868fe+dirty | 1206.85 ms | 1215.04 ms | 8.19 ms |
| d590428+dirty | 1221.23 ms | 1225.27 ms | 4.03 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| ea3e26e+dirty | 3.41 MiB | 4.58 MiB | 1.17 MiB |
| 80e4616+dirty | 3.38 MiB | 4.60 MiB | 1.22 MiB |
| 818a608+dirty | 3.19 MiB | 4.48 MiB | 1.29 MiB |
| 77061ed+dirty | 3.19 MiB | 4.54 MiB | 1.36 MiB |
| bef3709+dirty | 3.38 MiB | 4.78 MiB | 1.40 MiB |
| a206511+dirty | 3.41 MiB | 4.67 MiB | 1.25 MiB |
| 74979ac+dirty | 3.38 MiB | 4.60 MiB | 1.22 MiB |
| a2bb688+dirty | 3.19 MiB | 4.56 MiB | 1.37 MiB |
| 8a868fe+dirty | 3.38 MiB | 4.60 MiB | 1.22 MiB |
| d590428+dirty | 3.38 MiB | 4.78 MiB | 1.39 MiB |
Contributor
Author
|
@sentry review |
Contributor
Author
|
@claude review |
Strip leading ./ via parameter expansion before joining with the project root, so ./maps/main.jsbundle.map resolves to a clean absolute path instead of /project/root/./maps/main.jsbundle.map. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
lucas-zimerman
approved these changes
Feb 27, 2026
Collaborator
lucas-zimerman
left a comment
There was a problem hiding this comment.
that's a nice fix! LGTM!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📢 Type of change
📜 Description
Resolves a bug where a user-set relative
SOURCEMAP_FILE(e.g.SOURCEMAP_FILE=maps/main.jsbundle.maporSOURCEMAP_FILE=./maps/main.jsbundle.map) would not be found bysentry-cli.The Xcode build script runs from
ios/(PWD=ios), but the React Native bundle is created relative to the project root. Without this fix,sentry-cliwas looking in the wrong directory.Fix: if
SOURCEMAP_FILEis a relative path, it is resolved to an absolute path using the project root (RN_PROJECT_ROOT = PROJECT_DIR/..) before being passed tosentry-cli. A leading./is also stripped via bash parameter expansion (${SOURCEMAP_FILE#./}) to produce a clean absolute path.The default value (
$DERIVED_FILE_DIR/main.jsbundle.map) is already absolute and is unaffected.💡 Motivation and Context
Users setting a relative
SOURCEMAP_FILEin their Xcode build phase would silently produce incorrect source map paths, causing upload failures.Fixes #3889
💚 How did you test it?
Added 4 new unit tests to
sentry-xcode-scripts.test.tscovering:ios/)./-prefixed path is resolved against the project root with./stripped$DERIVED_FILE_DIR/main.jsbundle.mapAll existing tests continue to pass.
📝 Checklist
sendDefaultPIIis enabled🔮 Next steps