Page MenuHomePhabricator

[native] Avoid invariant crash in getDevNodeServerURL
ClosedPublic

Authored by ashoat on Jan 21 2023, 1:01 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 7, 11:36 PM
Unknown Object (File)
Thu, Oct 17, 6:37 AM
Unknown Object (File)
Thu, Oct 17, 6:37 AM
Unknown Object (File)
Thu, Oct 17, 6:35 AM
Unknown Object (File)
Thu, Oct 17, 6:19 AM
Unknown Object (File)
Sep 21 2024, 5:39 PM
Unknown Object (File)
Sep 5 2024, 8:18 PM
Unknown Object (File)
Aug 29 2024, 2:54 PM
Subscribers

Details

Summary

D6269 updated release builds to hit getDevNodeServerURL, which is causing a crash. This is happening because the result of getDevNodeServerURL is included in the default list of server options in the Developer tools section of the app.

There's probably no risk to calling this in production, especially since we already call dev-hostname.js code from release builds in natNodeServer. It's better to improve readability of the code and remove this invariant than to sidestep it.

Test Plan

Confirm release build no longer crashes

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

ashoat added inline comments.
native/utils/url-utils.js
43

This isn't technically needed, but I figured it's okay philosophically

My mistake, thanks for fixing that!
IIRC on prod the IP defaults to 192.168.1.1 (as the value from expo config will be null) so this shouldn't be harmful.

This revision is now accepted and ready to land.Jan 21 2023, 1:26 PM