Skip to content

Improve diagnostics when the packager cannot be reached or used - #58519

Open
javache wants to merge 1 commit into
react:mainfrom
javache:export-D119721144
Open

Improve diagnostics when the packager cannot be reached or used#58519
javache wants to merge 1 commit into
react:mainfrom
javache:export-D119721144

Conversation

@javache

@javache javache commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Summary:
Three gaps made an unusable packager connection close to impossible to
diagnose from logs.

ReconnectingWebSocket logged only Couldn't connect to "<url>", will silently retry, discarding the Throwable that onFailure already
receives. That throwable is the only thing separating a server which
rejected the WebSocket upgrade from one that was never reached — okhttp
reports the former as Expected HTTP 101 response but was '<code> <message>'
— so without it the two produced byte-identical output. It is now logged, and
onClosed distinguishes a peer-side close by including its code and reason.

ReactHostImpl silently falls back to the bundle shipped inside the app when
useDevSupport is true but allowPackagerServerAccess is false. No packager
request is issued in that state, so nothing downstream has anything to
report, and the app appears to ignore a perfectly healthy development server
for no visible reason. That combination now warns; the existing debug log is
kept for the ordinary case where dev support is off too.

Also repairs a comment in ReactHostImpl that had unrelated text spliced
into the middle of a word.

No public API changes, so ReactAndroid.api is unaffected.

Changelog:
[Android][Fixed] - Log the underlying cause when a packager connection fails
[Android][Added] - Warn when dev support is enabled but packager server access is disabled

Differential Revision: D119721144

Summary:
Three gaps made an unusable packager connection close to impossible to
diagnose from logs.

`ReconnectingWebSocket` logged only `Couldn't connect to "<url>", will
silently retry`, discarding the `Throwable` that `onFailure` already
receives. That throwable is the only thing separating a server which
rejected the WebSocket upgrade from one that was never reached — okhttp
reports the former as `Expected HTTP 101 response but was '<code> <message>'`
— so without it the two produced byte-identical output. It is now logged, and
`onClosed` distinguishes a peer-side close by including its code and reason.

`ReactHostImpl` silently falls back to the bundle shipped inside the app when
`useDevSupport` is true but `allowPackagerServerAccess` is false. No packager
request is issued in that state, so nothing downstream has anything to
report, and the app appears to ignore a perfectly healthy development server
for no visible reason. That combination now warns; the existing debug log is
kept for the ordinary case where dev support is off too.

Also repairs a comment in `ReactHostImpl` that had unrelated text spliced
into the middle of a word.

No public API changes, so `ReactAndroid.api` is unaffected.

Changelog:
[Android][Fixed] - Log the underlying cause when a packager connection fails
[Android][Added] - Warn when dev support is enabled but packager server access is disabled

Differential Revision: D119721144
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 14, 2026
@meta-codesync

meta-codesync Bot commented Sep 14, 2026

Copy link
Copy Markdown

@javache has exported this pull request. If you are a Meta employee, you can view the originating Diff in D119721144.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant