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.
This commit is contained in:
Pascal Precht 2020-03-04 12:21:43 +01:00 committed by Pascal Precht
parent 7ae17612dd
commit d9c8109201
1 changed files with 7 additions and 10 deletions

View File

@ -140,23 +140,20 @@ export default class ProxyManager {
isWs: false, isWs: false,
logger: this.logger, logger: this.logger,
plugins: this.plugins plugins: this.plugins
}) });
.serve(
this.host, this.httpProxy.serve(this.host, this.rpcPort);
this.rpcPort,
);
this.logger.info(`HTTP Proxy for node endpoint ${endpoint} listening on ${buildUrl("http", this.host, this.rpcPort, "rpc")}`); this.logger.info(`HTTP Proxy for node endpoint ${endpoint} listening on ${buildUrl("http", this.host, this.rpcPort, "rpc")}`);
if (this.isWs) { if (this.isWs) {
this.wsProxy = await new Proxy({ this.wsProxy = await new Proxy({
events: this.events, events: this.events,
isWs: true, isWs: true,
logger: this.logger, logger: this.logger,
plugins: this.plugins plugins: this.plugins
}) });
.serve(
this.host, this.wsProxy.serve(this.host, this.wsPort);
this.wsPort,
);
this.logger.info(`WS Proxy for node endpoint ${endpoint} listening on ${buildUrl("ws", this.host, this.wsPort, "ws")}`); this.logger.info(`WS Proxy for node endpoint ${endpoint} listening on ${buildUrl("ws", this.host, this.wsPort, "ws")}`);
} }
} }