trufflesuite / ganache-ui

Personal blockchain for Ethereum development
https://www.trufflesuite.com/ganache
MIT License
4.65k stars 797 forks source link

System Error when running Ganache + Drizzle: TypeError: Cannot read property 'connection' of undefined #930

Closed crazyrabbitLTC closed 5 years ago

crazyrabbitLTC commented 5 years ago

On using a vanilla install of the Truffle Drizzle truffle box, Ganache borks on any contract call from the demo application inside the truffle box. With the error below.

TypeError: Cannot read property 'connection' of undefined at ConnectionManager._updateSubscriptions (/node_modules/ganache-core/lib/webSocketServer.js:126:69) at Provider. (/node_modules/ganache-core/lib/webSocketServer.js:32:31) at emitTwo (events.js:125:13) at Provider.emit (events.js:213:7) at SubscriptionSubprovider. (/node_modules/ganache-core/lib/provider.js:48:10) at emitTwo (events.js:125:13) at SubscriptionSubprovider.emit (events.js:213:7) at SubscriptionSubprovider._notificationHandler (/node_modules/ganache-core/node_modules/web3-provider-engine/subproviders/subscriptions.js:96:8) at Array.forEach () at LogFilter. (/node_modules/ganache-core/node_modules/web3-provider-engine/subproviders/subscriptions.js:62:15) at emitOne (events.js:115:13) at LogFilter.emit (events.js:210:7) at LogFilter.update (/node_modules/ganache-core/node_modules/web3-provider-engine/subproviders/filters.js:407:10) at /node_modules/ganache-core/node_modules/web3-provider-engine/subproviders/filters.js:130:9 at /node_modules/ganache-core/node_modules/web3-provider-engine/subproviders/filters.js:278:5 at /node_modules/ganache-core/node_modules/web3-provider-engine/index.js:152:9 at /node_modules/ganache-core/node_modules/async/internal/once.js:12:16 at replenish (/node_modules/ganache-core/node_modules/async/internal/eachOfLimit.js:61:25) at /node_modules/ganache-core/node_modules/async/internal/eachOfLimit.js:71:9 at eachLimit (/node_modules/ganache-core/node_modules/async/eachLimit.js:43:36) at /node_modules/ganache-core/node_modules/async/internal/doLimit.js:9:16 at end (/node_modules/ganache-core/node_modules/web3-provider-engine/index.js:127:5)

Expected Behavior

I would expect the transaction would be mined without incident. This bug crashes ganache and thus makes it impossible to use.

Current Behavior

Upon making any transaction from the front end of the Truffle Drizzle trufflebox sample app, Ganache crashes.

Possible Solution

Not sure, but the typeError seems to be pretty clear.

Steps to Reproduce (for bugs)

  1. Follow installation and setup instructions here: https://github.com/truffle-box/drizzle-box
  2. run ganache-cli as explained in the instructions.
  3. run npm run start, to start application.
  4. Attempt to make any sort of contract call using the sample application front end.

Context

It doesn't work. Unsure if Ganache is broken or if Drizzle is broken. Ganache seems to work for my personal projects but I have trouble understanding how Drizzle calls could break Ganache.

Your Environment

OSX 10.13.6 Node: v9.7.1 Drizzle Truffle box current as of today: Sept 29, 2018 Ganache UI: v1.2.2, but problem exists also on Ganache CLI v6.1.6 (ganache-core: 2.1.5) and on version that runs on truffle develop (it does not expose version number)

crazyrabbitLTC commented 5 years ago

As a note, when starting ganache-cli -h 0.0.0.0 -b -3 there is a different error:

TypeError: Cannot read property 'connection' of undefined at n._updateSubscriptions (/usr/local/lib/node_modules/ganache-cli/build/cli.node.js:65:5443) at l. (/usr/local/lib/node_modules/ganache-cli/build/cli.node.js:65:3860) at l.emit (events.js:127:13) at o. (/usr/local/lib/node_modules/ganache-cli/build/cli.node.js:37:29971) at o.emit (events.js:127:13) at o._notificationHandler (/usr/local/lib/node_modules/ganache-cli/build/cli.node.js:149:95090) at Array.forEach () at b. (/usr/local/lib/node_modules/ganache-cli/build/cli.node.js:149:94594) at b.emit (events.js:127:13) at b.update (/usr/local/lib/node_modules/ganache-cli/build/cli.node.js:149:93163) at /usr/local/lib/node_modules/ganache-cli/build/cli.node.js:149:89913 at /usr/local/lib/node_modules/ganache-cli/build/cli.node.js:149:92148 at /usr/local/lib/node_modules/ganache-cli/build/cli.node.js:149:224092 at /usr/local/lib/node_modules/ganache-cli/build/cli.node.js:37:15226 at h (/usr/local/lib/node_modules/ganache-cli/build/cli.node.js:37:15661) at /usr/local/lib/node_modules/ganache-cli/build/cli.node.js:37:15714 at t.default (/usr/local/lib/node_modules/ganache-cli/build/cli.node.js:149:103608) at /usr/local/lib/node_modules/ganache-cli/build/cli.node.js:37:14598 at f (/usr/local/lib/node_modules/ganache-cli/build/cli.node.js:149:223936) at /usr/local/lib/node_modules/ganache-cli/build/cli.node.js:149:74602 at /usr/local/lib/node_modules/ganache-cli/build/cli.node.js:2:70761 at c (/usr/local/lib/node_modules/ganache-cli/build/cli.node.js:2:85888)

just4give commented 5 years ago

Hi there, I started seeing same error since evening. Did you find any solution?

dternyak commented 5 years ago

I had the same problem.

The way I solved it was by manually installing an older version of MetaMask (4.11.1). I'm not sure why, but using 4.12.0 causes ganache to crash or stall for me, with similar errors to those posting above.

You can grab the older release here: https://github.com/MetaMask/metamask-extension/releases

You'll have to load the unpacked CX into Chrome and use the older MetaMask until this is figured out.

dternyak commented 5 years ago

CC @danfinlay / @kumavis

just4give commented 5 years ago

@dternyak Thanks for the info and you are right , it has something to do with latest release of metamask. In my other computer which has older metamask, same application code is working fine. I will give it a try to install older version as you suggested.

just4give commented 5 years ago

UPDATE: As @dternyak suggested, I installed 4.11.1 and everything is back to normal.

benjamincburns commented 5 years ago

Glad to hear that switching MetaMask releases fixed it, but it sounds like our error handling & messages aren't up to snuff here.

benjamincburns commented 5 years ago

Looks like trufflesuite/ganache-core#186 is the same issue. Let's track this there.