I tried creating instance by:

const certificate = Certificate.deployed();


const certificate = Certificate.at(config.contract_id);

ANd i get this Error below:

TypeError: Cannot read property 'apply' of undefined
at Provider.sendAsync (/home/manzik/esatya/ecertificate/node_modules/truffle-contract/contract.js:23:36)
at RequestManager.sendAsync (/home/manzik/esatya/ecertificate/node_modules/truffle-contract/node_modules/web3/lib/web3/requestmanager.js:80:19)
at Object.get [as getNetwork] (/home/manzik/esatya/ecertificate/node_modules/truffle-contract/node_modules/web3/lib/web3/property.js:116:33)
at /home/manzik/esatya/ecertificate/node_modules/truffle-contract/contract.js:477:27
at new Promise (<anonymous>)
at Function.detectNetwork (/home/manzik/esatya/ecertificate/node_modules/truffle-contract/contract.js:468:14)
at Function.deployed (/home/manzik/esatya/ecertificate/node_modules/truffle-contract/contract.js:416:19)
at Object.<anonymous> (/home/manzik/esatya/ecertificate/server/helpers/web3.helper.js:42:33)
at Module._compile (module.js:652:30)
at loader (/home/manzik/esatya/ecertificate/node_modules/babel-register/lib/node.js:144:5) }
  • You're not calling any contract function in the code that you've posted here! The error Cannot read property 'apply' of undefined is given on a piece of code which you haven't bothered to post here, and this is not a guessing challenge, so please edit your question! – goodvibration Jun 27 '19 at 5:47
  • What is config contract_id ? Are u using ganache? Which web3js version? – Majd TL Jun 27 '19 at 7:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.