Search code examples
javascriptethereumsoliditytruffledrizzle

Truffle Drizzle error "TypeError: Cannot read property 'address' of undefined"


Expected:

After running the app, the user should see a "Loading Drizzle..." msg in the browser then soon followed by "Drizzle is ready".

Results:

The app stays stuck on "Loading Drizzle..." and there is an error in the chrome console:

Error

uncaught at root at root

at contractsSaga

at takeEvery

at addContract

at instantiateContract

TypeError: Cannot read property 'address' of undefined

I'm following this tutorial here: https://truffleframework.com/tutorials/getting-started-with-drizzle-and-react

And I'm at the current section:

Replace the render method

render() {
  if (this.state.loading) return "Loading Drizzle...";
  return <div className="App">Drizzle is ready</div>;
}

I've done that in my app, and expected to see the "Drizzle is ready" message, but instead got the error above.

Here is my repo: https://github.com/leongaban/truffle_drizzle_test

enter image description here

enter image description here


Solution

  • No contracts are deployed to your ganache network, which is why that error is occurring.

    In the root of your folder, make sure you run truffle migrate after truffle compile.