I am using truffle: "^4.1.14" and ganache-cli version "^6.1.8".
When I try to migrate to ganache cli network, it works without a problem.
But when I try to migrate to Rinkeby, it always fails.
The error message says TypeError: Cannot read property 'bind' of undefined
. The problematic line is buried somewhere deep in webpack, and I can't get to that script to inspect it or console.log it.
The relevant part of truffle.js looks like this
rinkeby_infura: {
provider: function() {
// using process.env.MNENOMIC would be safer, but this is test project
const mnemonic = require('./.mnemonic');
const apiKey = require('./.infura_api_key');
return new HdWalletProvider(mnemonic, 'https://rinkeby.infura.io/' + apiKey);
},
network_id: 4,
gas: 4612388 // Gas limit used for deploys
},
The full stack trace of the exception is below. It probably has something to do with connecting to Rinkeby via provider, at least from what I've googled so far. But I am unable to make it work.
$ ./node_modules/.bin/truffle migrate --network rinkeby_infura
C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\packages\truffle-provider\wrapper.js:26
var originalSendAsync = provider.sendAsync.bind(provider);
^
TypeError: Cannot read property 'bind' of undefined
at Object.wrap (C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\packages\truffle-provider\wrapper.js:26:1)
at Object.wrap (C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\packages\truffle-provider\index.js:7:1)
at Object.create (C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\packages\truffle-provider\index.js:21:1)
at Config.get [as provider] (C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\packages\truffle-config\index.js:165:1)
at Object.detect (C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\packages\truffle-core\lib\environment.js:46:1)
at C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\packages\truffle-core\lib\commands\migrate.js:91:1
at finished (C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\packages\truffle-workflow-compile\index.js:53:1)
at C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\packages\truffle-compile\index.js:314:1
at C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:158:1
at C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\~\async\dist\async.js:3888:1
at C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\~\async\dist\async.js:473:1
at replenish (C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\~\async\dist\async.js:1006:1)
at iterateeCallback (C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\~\async\dist\async.js:995:1)
at C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\~\async\dist\async.js:969:1
at C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\~\async\dist\async.js:3885:1
at C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:154:1
at C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\~\async\dist\async.js:1140:1
at C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\~\async\dist\async.js:473:1
at iteratorCallback (C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\~\async\dist\async.js:1064:1)
at C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\~\async\dist\async.js:969:1
at C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\~\async\dist\async.js:1137:1
at C:\src\personal\ens-registrar\node_modules\truffle\build\webpack:\packages\truffle-compile\profiler.js:133:1
at FSReqWrap.oncomplete (fs.js:155:5)
provider.sendAsync.bind
that you are trying to readbind
ofundefined
, so it issendAsync
is undefined. I remember that web3 0.20 -> 1.0 changed fromprovider.sendAsync()
toprovider.send()
so perhaps there are some dependencies in your project that are using the wrong version of web3.