Ethers.js: ethers-providers 2.1.5 breaks getDefaultProvider()

Created on 28 Oct 2017  路  4Comments  路  Source: ethers-io/ethers.js

45

The error:

/Users/gregory/repos/ethers-finicking/node_modules/ethers-providers/provider.js:487
    if (typeof(network.chainId) !== 'number') { throw new Error('invalid chainId'); }
                      ^

TypeError: Cannot read property 'chainId' of undefined
    at Function._legacyConstructor (/Users/gregory/repos/ethers-finicking/node_modules/ethers-providers/provider.js:487:23)
    at new InfuraProvider (/Users/gregory/repos/ethers-finicking/node_modules/ethers-providers/infura-provider.js:22:28)
    at Object.getDefaultProvider (/Users/gregory/repos/ethers-finicking/node_modules/ethers-providers/index.js:12:9)
    at Object.<anonymous> (/Users/gregory/repos/ethers-finicking/index.js:5:33)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)

How to reproduce:
npm i [email protected]

var providers = require('ethers-providers');
var provider = providers.getDefaultProvider();  // throws here
bug fixed

All 4 comments

Fixed locally and updated test cases to check for this in the future.

Once local test cases and Travis-CI have verified it, I will publish to npm and update this issue.

Also note, as a work around for now:

var provider = providers.getDefaultProvider('homestead');

Cool, thanks! I'm just sitting on the previous version for now.

Passed all tests and published.

Thanks! :)

Was this page helpful?
0 / 5 - 0 ratings