Repository navigation
[No QA] Fix [Sentry: APP-8BM] HybridApp iOS NSInvalidArgumentException nil object in RCTNetworking prioritizedHandlers - #92918
Conversation
…ject in RCTNetworking prioritizedHandlers
|
|
|
@codex review please |
|
Codex Review: Didn't find any major issues. Keep them coming! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
@DylanDylann Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
🚧 @mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.4.7-0 🚀
Bundle Size Analysis (Sentry): |
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.4.7-4 🚀
|
Explanation of Change
Fixes a fatal iOS crash (APP-8BM) in HybridApp where
RCTNetworking's default URL-request-handler provider builds its handler list using an Objective-C array literal (@[...]) with[moduleRegistry moduleForName:"BlobModule"]at index 3. Since@[…]compiles to+[NSArray arrayWithObjects:count:]which raisesNSInvalidArgumentExceptionon any nil element, the crash is fatal. The fix replaces the literal with anNSMutableArraybuilt from the three always-non-nil handlers (RCTHTTPRequestHandler,RCTDataRequestHandler,RCTFileRequestHandler) and conditionally appendsBlobModuleonly when the registry lookup is non-nilOk, but will the app work correctly without the
BlobModulewhen it'snil?From what I understand, if the app tries to fetch a
blob:URL, the request will go throughRCTNetworking's handler list and none of the registered handlers will claim it. In this case it should fail silently and log an error:so the app shouldn't crash. Additionally, based on my research, neither NewDot nor OldDot actually create or fetch
blob:URLs on the iOS native app - which meansBlobModulebeing absent should have no practical impact.Fixed Issues
$ #92413
PROPOSAL: N/A
Tests
It's hard to reproduce this crash, so to test this fix I:
blobModuleisnilby changing thereact-nativecode:This change is in the
node_modules/react-native/Libraries/AppDelegate/RCTAppSetupUtils.mmfile, line 103This results in immediate crash on app start with the same error as reported on sentry:
[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[3]nilvalue checkWith this there is no crash on start obviously, as it works as current prod, but with the
nilguard. As it's hard to reproduce thenilcase without code change, I proceeded to the 3. stepnilvalue withnilvalue guardSeems to be working fine, both Old and New app, switched a lot of times between them, no crash, no problems
Offline tests
QA Steps
No QA
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari