Click here to Skip to main content
16,020,822 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to run a smart contract project I got from GitHub for my final year project. The idea of the project is using a smart contract as access control for IoT devices. I installed all the prerequisite tools (nodejs, ganache,web3, sol, npm, truffle.......) and I'm using Ubuntu version 20.4.01 but I keep getting this annoying "capability.AccessRequest is not a function" error over and over again. I looked up for the solution on this website and other websites but, with no luck whatsoever. I tried to resolve the issue by myself but unfortunately, I don't have any prior experiences on Ethereum, nor do I have any experience in Js. So if you could please show me the way to solve this issue I would really appropriate it.

I attached the command line error below.

 ubuntu@ubuntu-VirtualBox:~/Desktop/Blockchain-CapBAC/capability$ node src/js/watchRequest.js 
/home/ubuntu/Desktop/Blockchain-CapBAC/capability/src/js/watchRequest.js:205
var event = capability.AccessRequest();
                       ^
TypeError: capability.AccessRequest is not a function
    at Object.<anonymous> (/home/ubuntu/Desktop/Blockchain-CapBAC/capability/src/js/watchRequest.js:205:24)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)


and the code is here sorry the code is very long this just a segment

What I have tried:

// addressの読み込み
    var networks = builded.networks;
    var contractAddress = networks[13].address;
    // var address = 0xF2Cf314DB895fA6f6E41cF03b4BDf981e68fc6C3;

    var capability = new web3.eth.Contract(abi, contractAddress);
    // console.log(smartKey);
    var event = capability.AccessRequest();
   
    });
Posted
Comments
BabyYoda 16-Dec-20 9:13am    
The error says "capability.AccessRequest is not a function". in watchRequest.js there is code to call apability.AccessRequest but it does not exist.
Member 15022644 16-Dec-20 10:59am    
Yes Baby Yoda I understood tqvm for ur respond :)
BabyYoda 16-Dec-20 11:10am    
If you understand than I am not sure what you are asking us to do.
Member 15022644 16-Dec-20 11:18am    
I'm asking how to resolve this issue I ain't asking u guys to solve it for me (it won't help me at all) and in ur previous comment u said something that made a lot of sense so I will look it up and see how to recall the "capability.AccessRequest" function. Thank you for ur patient and apologize for the inconveniences.
BabyYoda 16-Dec-20 12:07pm    
If this is not code that you wrote than I suggest you contact the people where you downloaded it from.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900