fix(middleware): set debugger websocket origin#297
Open
V3RON wants to merge 1 commit into
Open
Conversation
Send a localhost Origin header when Rozenite for Agents opens the React Native debugger WebSocket. This lets React Native 0.85 dev-middleware accept the upgrade.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
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.
What is this?
This PR fixes Rozenite for Agents failing to create a session against React Native 0.85 Metro servers. React Native dev-middleware now validates the
Originheader on debugger WebSocket upgrades, and Rozenite was opening the CDP socket without one, which caused the upgrade to be rejected with HTTP 401.Fixes #296.
How does it work?
When the agent session opens the target
webSocketDebuggerUrl, it now passes a WebSocket header withOrigin: http://localhost:<metroPort>.localhostis accepted by React Native dev-middleware's debugger WebSocket origin allow-list, so the connection can pass the upgrade check before Rozenite continues its normal CDP bootstrap flow.The session test WebSocket mock now records constructor options, and the middleware session test asserts that the debugger socket is created with the expected localhost Origin header.
Why is this useful?
This restores the first step of
rozenite agent session createfor React Native 0.85 projects, where plain HTTP target discovery succeeds but the debugger WebSocket connection is rejected before the agent can bootstrap. The change is narrow to the agent's CDP connection path and keeps compatibility with the existing Metro host and port tracking used by the middleware.