I am getting this error message when trying to interact with my smart contract on my react front end. I am running localhost3000 and which requires metamask to sign in.
Unhandled Rejection (Error): call revert exception (method="symbol()", errorSignature=null, errorArgs=[null], reason=null, code=CALL_EXCEPTION, version=abi/5.0.8)
Logger.makeError
/Users/username/Desktop/final-4/src.ts/index.ts:205
Logger.throwError
/Users/username/Desktop/final-4/src.ts/index.ts:217
Interface.decodeFunctionResult
/Users/username/Desktop/final-4/src.ts/interface.ts:326
323 | eventFragment = this.getEvent(eventFragment);
324 | }
325 | const topics = [];
> 326 | const dataTypes = [];
| ^ 327 | const dataValues = [];
328 | if (!eventFragment.anonymous) {
329 | topics.push(this.getEventTopic(eventFragment));
View compiled
Contract.<anonymous>
/Users/username/Desktop/final-4/src.ts/index.ts:309
fulfilled
http://localhost:3000/static/js/0.chunk.js:5079:24
Also from the source tab in inspect:
Uncaught (in promise) Error: call revert exception (method="symbol()", errorSignature=null, errorArgs=[null], reason=null, code=CALL_EXCEPTION, version=abi/5.0.8)
Uncaught (in promise) Error: call revert exception (method="balanceOf(address)", errorSignature=null, errorArgs=[null], reason=null, code=CALL_EXCEPTION, version=abi/5.0.8)
Here is my directory structure:
client
|--node_modules
|-—public
|—-src
|—-contracts
|—-Address.json
|—-Context.json
|—-ERC20.json
|—-IERC20.json
|—-Migrations.json
|—-PreciousChicken.json
|——SafeMath.json
|—-App.css
|—-App.js
|—-App.test.js
|—-index.css
|—-logo.svg
|—-reportWebVitalls.js
|—-setupTests.js
|—-gitignore
|—-package-lock.json
|—-package.json
|—-yarn.lock
|—-contracts
|—-Migrations.sol
|—-MyPreciousToken
|—-migrations
|—-1_initial_migations.js
|—-2_deploy_contracts.js
|—-node-modules
|—-test
This error (CALL_EXCEPTION) happens when your smart contract is not deployed yet.
Wait the transaction ends:
await contract.deployTransaction.wait()
I got the same error because I was trying to use a contract's Ropsten address instead of it's Mainnet address. Make sure that whatever contract you're using is deployed and is on the correct network.
Connecting a proper test network in the wallet could prevent this issue while you are building a smart contract in the test network.
E.g for me, I had to connect Rinkeby network in the wallet, but actually pointing a main network.
For me the reason was when I redeployed the contract, the contract's json files generated in the build needed to be replaced in my react app as well.
Double check that your contract is deoloyed on what ever test network you are using !
I ran npx hardhat run scripts/deploy.js --network localhost while my testnet was running in a seperate terminal and, it fixed the error.
hope this helps anyone
First make sure your local blockchain network npx hardhat node is running in a separate terminal and access the local network console in a separate terminal npx hardhat console --network localhost.
If the error still pops up for the commands fired in the terminal of local network console, then
The way to resolve the issue is to check the logs presented in the terminal where your local blockchain network is running.
For my case I created the contract instance with wrong address. And every time I did try to execute the functions of the contract instance created with wrong address, for each execution there was a log in the terminal running the local blockchain network as :
WARNING: Calling an account which is not a contract
From: 0xf39fd6e51aad88f......................266
To: 0xf39fd6e51aad88f......................266
Try to deploy the main contract again.
Run the below commands in separate terminals parallelly
npx hardhat node
npx hardhat run scripts/deploy.js --network localhost
I got this error when trying to access an element of a public array that didn't exist. The array had only one element inside so I had to change from index 1 to 0.
const elIndex = ethers.BigNumber.from(0);
await ExampleContract.nfts(elIndex);
```
Related
i am setting up react with ether.js and smart contract is deployed using hardhat on localhost network. React app is connected to metasmask using
const provider = new ethers.providers.Web3Provider(window.ethereum);
the contract is written below
//SPDX-License-Identifier: Unlicense
pragma solidity ^0.8.0;
import "hardhat/console.sol";
contract Greeter {
string private greeting;
constructor(string memory _greeting) {
console.log("Deploying a Greeter with greeting:", _greeting);
greeting = _greeting;
}
function greet() public view returns (string memory) {
return greeting;
}
function setGreeting(string memory _greeting) public {
console.log("Changing greeting from '%s' to '%s'", greeting, _greeting);
greeting = _greeting;
}
}
i deployed this contract using npx hardhat run script.js.In the react code i am fetching contract object using
const erc20=new ethers.Contract(address,obj.abi,signer);
and in the useEffect i am trying to call erc20.greet()
which is giving error in console.
**
(in promise) Error: call revert exception (method="greet()", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.5.0)
**
You need to make sure these points:
Your Metamask extension is connecting to your hardhat localhost network.
When you run your React app in a browser with the Metamask extension installed, make sure that your Metamask is connecting to your hardhat localhost network (by default, it is localhost:8545). If Metamask is connecting to a different network, you will get that error.
(Note: Because the Metamask extension hides test networks by default, you will need to make it show test networks so that you can see your hardhat localhost network listed.)
Use the correct contract address.
When you start a hardhat local network, hardhat will return a list of accounts like this:
WARNING: These accounts, and their private keys, are publicly known. Any funds sent to them on Mainnet or any other live network WILL BE LOST.
Account #0: 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 (10000 ETH)
Private Key: 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
Account #1: 0x70997970c51812dc3a010c7d01b50e0d17dc79c8 (10000 ETH)
Private Key: 0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
...
When you deployed that smart contract using hardhat on localhost network, hardhat will return something like this:
[contract-name] deployed to: [contract-address]
Make sure that you use that [contract-address] as the value of the address argument here:
const erc20=new ethers.Contract(address,obj.abi,signer);
A [contract-address] and an account look quite similar, but they represent two different things. If you use an account instead the [contract-address], you will get the error.
When I try to install yarn, I've got the following output:
Internal Error: Error when performing the request
at ClientRequest.<anonymous> (C:\Program Files\nodejs\node_modules\corepack\dist\corepack.js:3937:20)
at ClientRequest.emit (node:events:390:28)
at TLSSocket.socketErrorListener (node:_http_client:447:9)
at TLSSocket.emit (node:events:390:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
TL;DR
Create a custom CA certificate file (in this example c:\temp\combo.ca.cer) containing BASE64-encoded DERs of all certs your corporate network security solution is presenting to Node.js when Node.js makes HTTPS requests
I used advice from https://stackoverflow.com/a/44726189 to create my custom CA cert file
set NODE_EXTRA_CA_CERTS=c:\temp\combo.ca.cer
corepack enable
yarn set version stable
Root Cause Analysis
I had the "Internal Error: Error when performing the request" at "corepack.js:3937:20" like everyone who's been here so I looked in line 3937 and discovered it was a vanilla https.get call. I stuck in some extra debugging into corepack.js to see what was being accessed and discovered it was failing trying to reach "https://registry.npmjs.com/pnpm".
I navigated to "https://registry.npmjs.com/pnpm" in my web browser and discovered my corporate environment let it load up with no errors. So I fired up Node JS and issued to see what would happen:
https.get("https://registry.npmjs.com/pnpm", {}, res => console.log(res));
I received a "unable to get local issuer certificate" error. In my corporate environment, there's a security solution that injects it's own self-signed certificates into responses from any outbound https requests. What that means for me is that I need to instruct anything issuing https requests (eg Node.js and curl) to use a custom CA certificate file.
To get corepack to work, I first hard-coded a custom CA certificate file into corepack.js and while it's pretty ugly, it did work. A bit of further digging around I found the NODE_EXTRA_CA_CERTS environment variable option used by Node.js so also tried the following in a Administrator-privileged cmd session with success (also removing the corepack.js hack I made earlier):
set NODE_EXTRA_CA_CERTS=c:\temp\combo.ca.cer
corepack enable
yarn set version stable
The combo.ca.cer was constructed by navigating to https://registry.npmjs.com/pnpm and exporting all the CA certs (root and any intermediate CA certs) to text files and copy-pasting the contents of all the CA cert files into a single text file called combo.ca.cer. I used advice from https://stackoverflow.com/a/44726189 to create my custom CA cert file.
As part of the initial setup of a work computer, I got this same error. Even a clean run of yarn (yarn init -2 in an empty folder) would cause the error.
Turning off my VPN made yarn work as expected.
Googling the error lead me to this page which got me to suspect the VPN. https://github.com/nodejs/corepack/issues/67
I had the same problem and for me it was solved by running yarn set version stable.
I have a big problem trying to deploy a react app to a azure app service with visual studio azure app service extension, im getting this error
info There appears to be trouble with your network connection. Retrying...
error An unexpected error occurred: "https://registry.yarnpkg.com/date-fns/-/date-fns-2.0.0-alpha.27.tgz: ESOCKETTIMEDOUT".
Im using yarn and i read that increase the network timeout maybe solve this. But how i can do it?
I am using yarn and i read that increase the network timeout maybe
solve this. But how i can do it?
You can try running it in your terminal :
$ yarn install --network-timeout 1000000
And also try to clear the cache by running the below cmd
$ yarn cache clean
$ yarn // to install dependencies, no need for "yarn install"
Please refer the below links for more information:
.yarn is having troubles with the network connection | SO THREAD .
. React deployment keeps failing with ESOCKETTIMEDOUT | MS Q&A
Try to NOT run build on Azure. Do this by answering NO when you publish.
Have you already made the settings to build on Azure (answered yes) .. undo by deleting the following files
.vscode\settings.json
.deployment
Create the file .yarnrc, and write into file:
network-timeout 1000000
Save file & deploy your app with the file
There is more than one example where I have seen this status from a pod running in openshift origin. In this case it was the quickstart for the cdi camel example. I was able to successfully build and run it locally (non - openshift) but when I try to deploy on my local openshift (using mvn -Pf8-local-deploy), I get this output for that particular example (snipped for relevance) :-
[vagrant#vagrant camel]$ oc get pods
NAME READY STATUS RESTARTS AGE
cdi-camel-z4czs 0/1 CrashLoopBackOff 4 2m
Tail of the logs are as under:-
Error occurred during initialization of VM
Error opening zip file or JAR manifest missing : agents/jolokia.jar
agent library failed to init: instrument
Can someone help me solve this ?
If the state of the pod goes in to CrashLoopBackOff it usually indicates that the application within the container is failing to start up properly and the container is exiting straight away as a result.
If you use oc logs on the pod name, you may not see anything useful though as it would capture what the latest attempt to start it up is doing and may miss messages.
What you should do is instead provide the --previous or -p option to oc logs along with the pod name. That will show you the complete logs from the previous attempt to start up the container.
If this is an arbitrary Docker image you are using, a common problem that can occur and which would cause the container not to start, is an application image which requires to be run as the root user. Because running an application inside of a container as root still has risks, OpenShift doesn't allow you to do that by default and will instead run as an arbitrary assigned user ID. The application image may not be designed with this possibility in mind and so is failing.
So try and get those logs messages and see what the problem is.
Temporary workaround -> https://github.com/fabric8io/ipaas-quickstarts/issues/1157
Basically, the src/main/hawt-app directory needs to be deleted.
I am developing a MEAN application. When I use localhost for local development the app is running fine on http://localhost:3300 when Internet is there but throws below error when the Internet is disconnected.
process.nextTick(function() { throw err; })
^
Error: getaddrinfo ENOENT
at Object.exports._errnoException (util.js:746:11)
at errnoException (dns.js:49:15)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:94:26)
[nodemon] app crashed - waiting for file changes before starting...
Can anyone help me resolving this strange issue? As app is on localhost,it should not have any dependency on Internet.
My MongoDB connection is on mongodb://localhost:27017.
Thanks!
Try changing all localhost occurrences with 127.0.0.1
Had the same problem. Turns out without an active internet connection localhost cannot be resolved into a valid IP.
Make your own local network.
I don't know the exact reason why this is happening. But I noticed that if your pc is not assigned an IP address it will produce this error.
So what I did was, I turned my portable wifi hotspot on and re-run the app and whoa! It worked! That hotspot assigned an IP address to my pc. So, it simply means you should be connected to any network. It can be your mobile hotspot too.