Skip to content

Commit 2639700

Browse files
felixtrzmeta-codesync[bot]
authored andcommitted
iwsdk-cli: connect to dev server via 127.0.0.1 instead of localhost
Summary: iwsdk/cli's runtime transport opens a WebSocket to ${protocol}://localhost:${port}/__iwer_mcp for every dev-server command. On Linux hosts whose Node resolver prefers IPv6 (default on many distros and inside many containers), `localhost` resolves to `::1` first. Vite's dev server binds to `0.0.0.0` (IPv4 only), so the connection fails with `ECONNREFUSED ::1:<port>` and every CLI command falls back to `browser_not_ready`. Switch the URL to the `127.0.0.1` literal. The dev server's `/__iwer_mcp` upgrade route is bound on the same socket, so the IPv4 literal resolves on every host; behaviour on IPv4-first systems is unchanged. Reviewed By: zjm-meta Differential Revision: D105639415 fbshipit-source-id: 291ef8b3ae2b7fd7cac6c1a9f10f7e2baee6cfbf
1 parent 6b473ff commit 2639700

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/cli/src/runtime-transport.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ async function trySendRuntimeCommand(
173173
): Promise<RuntimeCommandResponse> {
174174
return new Promise<RuntimeCommandResponse>((resolve, reject) => {
175175
const requestId = `${Date.now()}-${Math.random().toString(16).slice(2)}`;
176-
const wsUrl = `${protocol}://localhost:${port}/__iwer_mcp`;
176+
const wsUrl = `${protocol}://127.0.0.1:${port}/__iwer_mcp`;
177177
const ws = new WebSocket(wsUrl, {
178178
rejectUnauthorized: false,
179179
});

0 commit comments

Comments
 (0)