react: [DevTools Bug] Unsupported Bridge operation "0"
Website or app
local app development
Repro steps
just install react devtools and downgrade to 4.11.0
How often does this bug happen?
Every time
DevTools package (automated)
react-devtools-core
DevTools version (automated)
4.23.0-e28a0db22
Error message (automated)
Unsupported Bridge operation “0”
Error call stack (automated)
at /Users/softwaremac/Desktop/Users/JigneshJani/RNProjects/WifiSwitch/WifiSwitchV2_29_5/node_modules/react-devtools/node_modules/react-devtools-core/dist/standalone.js:53:333837
at c.emit (/Users/softwaremac/Desktop/Users/JigneshJani/RNProjects/WifiSwitch/WifiSwitchV2_29_5/node_modules/react-devtools/node_modules/react-devtools-core/dist/standalone.js:53:277732)
at /Users/softwaremac/Desktop/Users/JigneshJani/RNProjects/WifiSwitch/WifiSwitchV2_29_5/node_modules/react-devtools/node_modules/react-devtools-core/dist/standalone.js:53:279273
at /Users/softwaremac/Desktop/Users/JigneshJani/RNProjects/WifiSwitch/WifiSwitchV2_29_5/node_modules/react-devtools/node_modules/react-devtools-core/dist/standalone.js:53:659742
at Array.forEach (<anonymous>)
at A.e.onmessage (/Users/softwaremac/Desktop/Users/JigneshJani/RNProjects/WifiSwitch/WifiSwitchV2_29_5/node_modules/react-devtools/node_modules/react-devtools-core/dist/standalone.js:53:659726)
at A.t (/Users/softwaremac/Desktop/Users/JigneshJani/RNProjects/WifiSwitch/WifiSwitchV2_29_5/node_modules/react-devtools/node_modules/react-devtools-core/dist/standalone.js:44:3009)
at A.emit (events.js:315:20)
at e.exports.L (/Users/softwaremac/Desktop/Users/JigneshJani/RNProjects/WifiSwitch/WifiSwitchV2_29_5/node_modules/react-devtools/node_modules/react-devtools-core/dist/standalone.js:8:13567)
at e.exports.emit (events.js:315:20)
Error component stack (automated)
No response
GitHub query string (automated)
https://api.github.com/search/issues?q=Unsupported Bridge operation in:title is:issue is:open is:public label:"Component: Developer Tools" repo:facebook/react
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 14
- Comments: 25 (12 by maintainers)
Commits related to this issue
- Disable unsupported Bridge protocol version dialog and add workaround for old protocol operations format (#24093) Rationale: The only case where the unsupported dialog really matters is React Naive. ... — committed to facebook/react by deleted user 2 years ago
- chore: bump react-devtools-core to 4.24.1 (#3542) Summary: Related to this issue: https://github.com/facebook/react/issues/23307 ## Changelog bump react-devtools-core to 4.24.1 Pull Request resolv... — committed to facebook/flipper by deleted user 2 years ago
- Disable unsupported Bridge protocol version dialog and add workaround for old protocol operations format (#24093) Rationale: The only case where the unsupported dialog really matters is React Naive. ... — committed to zhengjitf/react by deleted user 2 years ago
I can confirm replicating this on a vanilla react-native app using flipper (where I believe this issue was created from), the issue also persists on 4.22 as well as 4.23, however using ❯ npm i -g react-devtools@4.21.0 sorts the issue for me
As a workaround for anyone reading this, you could use an approach like Resolutions to work around the backend version mismatch, e.g.
I used a similar resolution in my test React Native project to force downgrade the backend to 4.19.1.
@usrbowe Bumping the version of the React DevTools (frontend) used in Flipper sounds like a good idea. 4.24.1 is more “compatible” with older backend versions.
Bug fix has been released as version 4.24.1 (#24100). You should be able to fix this issue by upgrading the frontend (the UI you run) to the latest NPM release.
Looking at the history of the Bridge protocol stuff, we basically have the following changes:
The source revisions for the above versions are:
Exporting and comparing these revisions…
Looking at the store diffs, I see the following changes between protocol changes::
TREE_OPERATION_REMOVE_ROOTandTREE_OPERATION_UPDATE_ERRORS_OR_WARNINGSmessages. I think, maybe, this isn’t technically a breaking change since both operations are new.TREE_OPERATION_ADDmessage for new root nodes. These bits specified strict mode compatibility and owner metadata properties.If I had thought to design the operations array up front to include its protocol version as the first bit, then we could easily support backwards compatability in cases like this. Really bad oversight on my part, in hindsight. As it is now, we could try to do this (if we already have the protocol version) but there would be cases we can’t handle (e.g. the backend is too old to report its protocol and the frontend times out).
Maybe we could queue up operations until we know (or infer) the backend version? I’m not sure how hard this would be to implement in practice, especially when considering cases like reload and profile. Probably hard.
I’m not sure there’s really a way to fix it at this point. If I could go back, unpublish and overwrite each of the older revisions to add this info, maybe…but NPM doesn’t support that kind of an operation.
Okay, after digging into this– I can repro it. I’m not sure there’s a great workaround or “fix” for it though. The underlying issue (explained in #21326) still needs to be handled.
Maybe React Native could do a better job of prompting/matching backend and frontend versions during installation? I’m not sure how React DevTools (the frontend UI) could do this other than via some protocol version check like we are already doing. (Although if anyone has ideas I’d love to talk about them.)
In hindsight, I should have made the very first parameter in the operations array a protocol version number. Then the frontend could treat messages different based on their known protocol. But it’s too late to make this change and so here we are.
I ran into the same issue on a new React Native 0.67.3 app generated with
react-native initClicking dismiss on the Unsupported Bridge operation “0” message removes that message but then I am presented with this error:
I checked which version of react-devtools-core that the Metro server is using:
So React Native uses react-devtools-core 4.19.1, not too far behind the latest. So it should be compatible right?
Well by downgrading to use the exact version that React Native uses, it is now working for me. So I guess 4.19.1 and 4.23.0 are not compatible