Skip to content

Commit d9c8109

Browse files
committed
fix(stack/proxy): ensure wsProxy and httpProxy have correct type
Both, `httpProxy` and `wsProxy` inside `Proxymanager` have been assigned the value of `new Proxy(...).serve()` which is an instance of `express`. This was wrong and causes runtime errors when proxies are being stopped as they don't have a `stop()` API.
1 parent 7ae1761 commit d9c8109

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

packages/stack/proxy/src/index.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,23 +140,20 @@ export default class ProxyManager {
140140
isWs: false,
141141
logger: this.logger,
142142
plugins: this.plugins
143-
})
144-
.serve(
145-
this.host,
146-
this.rpcPort,
147-
);
143+
});
144+
145+
this.httpProxy.serve(this.host, this.rpcPort);
148146
this.logger.info(`HTTP Proxy for node endpoint ${endpoint} listening on ${buildUrl("http", this.host, this.rpcPort, "rpc")}`);
147+
149148
if (this.isWs) {
150149
this.wsProxy = await new Proxy({
151150
events: this.events,
152151
isWs: true,
153152
logger: this.logger,
154153
plugins: this.plugins
155-
})
156-
.serve(
157-
this.host,
158-
this.wsPort,
159-
);
154+
});
155+
156+
this.wsProxy.serve(this.host, this.wsPort);
160157
this.logger.info(`WS Proxy for node endpoint ${endpoint} listening on ${buildUrl("ws", this.host, this.wsPort, "ws")}`);
161158
}
162159
}

0 commit comments

Comments
 (0)