Skip to content

Commit caae922

Browse files
jrainvilleiurimatias
authored andcommitted
fix(@embark/proxy): only up event listeners on available providers
Only the Ganache provider has the setMaxListener
1 parent e5b15c3 commit caae922

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/stack/proxy/src/proxy.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ export class Proxy {
4242
_createWeb3RequestManager(provider) {
4343
const manager = new Web3RequestManager.Manager(provider);
4444
// Up max listener because the default 10 limit is too low for all the events the proxy handles
45-
// Warning mostly appeared in tests
46-
manager.provider.setMaxListeners(100);
45+
// Warning mostly appeared in tests. The warning is also only with the Ganache provider
46+
// eslint-disable-next-line no-unused-expressions
47+
manager.provider?.setMaxListeners?.(100);
4748
return manager;
4849
}
4950

@@ -53,6 +54,7 @@ export class Proxy {
5354
// Using net_version instead of eth_accounts, because eth_accounts can fail if EIP1102 is not approved first
5455
await reqMgr.send({ method: 'net_version' });
5556
} catch (e) {
57+
this.logger.debug(e);
5658
throw new Error(__(`Unable to connect to the blockchain endpoint`));
5759
}
5860
}

0 commit comments

Comments
 (0)