lakshya-20 / supply-chain

Decentralised food supply chain to trace products from end to end and provide a smart and reliable way of providing information to the customers.
food-supply-chain.vercel.app
GNU Affero General Public License v3.0
59 stars 24 forks source link

[BUG] Unhandled Rejection (TypeError): Cannot read properties of undefined (reading 'address') #21

Closed crisjhatin closed 1 year ago

crisjhatin commented 2 years ago

Describe the bug Unhandled Rejection (TypeError): Cannot read properties of undefined (reading 'address') Area Where Bug Occurred

How to reproduce the error/bug

  1. Complete the steps to deploy it locally.
  2. When you open the localhost, an error screen appears with that description ("Unhandled Rejection (TypeError): Cannot read properties of undefined (reading 'address')")

Additional context The system says that the error is in the following file: supply-chain/src/Services/Contexts/ContractContext.js:45

45 | const main = new web3.eth.Contract(MainContract.abi, MainContract.networks[networkId].address);

lakshya-20 commented 2 years ago

Hi CristianJhairT

I tried to reproduce this error and it is because of your wallet configuration, here is how you can resolve this: Step 1: Redeploy Smart Contracts Step 2: Start the client application Step 3: Ensure your wallet is configured to connect to the blockchain network to which you deployed the smart contracts.

Rose2395 commented 1 year ago

Hi CristianJhairT

I faced the same issue and iI updated my truffle version to 5.1.5, cause Truffle v5 versions earlier than 5.1.5 won't successfully compile ^0.6.0 solidity contracts.