-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't catch Unhandled Rejection (Error): resolver or addr is not configured for ENS name (argument="name", value="", code=INVALID_ARGUMENT, version=contracts/5.0.8) #1234
Comments
Thanks! I’ll look into this shortly... |
Typings for ethers: |
Code:
|
To clarify the issue, I test this code especially for throwing error, passing |
I agree. Errors should be recoverable using normal JavaScript conventions. :) |
(you shouldn’t need to await) |
Okay, I added |
Yeah. The await will have no effect. I need to swallow the error. It won’t throw an error in general though, since that resolution of ENS name to address is async. In your case though, I can add a condition that throws if address is not a string, so you will get a sync error for you. But in general it won’t fail for users who pass in an invalid string until they try calling a method on the Contract. I’ll check into these changes tomorrow and kinda trace through some behaviour to make sure it all still makes sense. :) |
The same behavior with empty string also:
This is stack trace:
|
Any update? |
This should be fixed in 5.0.31. Try it out and let me know! :) |
I think this is fixed, so I'll close this now. If not, please re-open. Thanks! :) |
seems like it might be still broken for me @ricmoo |
Experiencing same issue; error is uncatchable
Using ethers EDIT: Nevermind! My issue was unrelated. It's working as expected. |
@miguelmota How did you fix it? I have the same error |
@jeromevvb the issue for me was I had a nullish address which of course can't be resolved. Check your input values |
We saw the same error as posted at the top of this thread. In short don't do |
@ricmoo It seems to me like this needs to be reopened, as apparently there are many people struggling to track down why an ethers function is being called with an empty or undefined address. I have hit this many times myself, where the stack trace does not give any indication of which code triggered the |
I would rather focus on getting v6 out the door though. The error is correct, that somewhere an address is expected, that "undefined" is being passed in. From the issues, so far it seems quite often this comes from people using unset environment variables, mis-typing the property on an object or passing in values from an optional function argument. This seems little outside the scope of ethers to attempt to detect. One problem with making this easier to track down, is that this can occur at many stages in a heavily async process, such as in a nested struct, which currently allows nested async values, so it isn't a simple matter to make this work in general. In v6, a lot of the async options are going away (i.e. methods no longer accept Deferrables, for many values), so I would prefer getting that out. If you (or anyone else) can find a simple way to detect and display the stack in a meaningful sense though, I am all ears. But no easy, safe and portable solution comes to mind. Does that make sense? |
Thanks a lot @ricmoo for the great response. Yes, if there's no easy way of getting better stack traces then I guess we can just look forward to v6. However as a quick fix, I'm pretty confident that there should be a way to reword the existing message to make it much more helpful. The ENS reference is generally a complete wild goose chase. As you say, this error is often caused by incorrect arguments, and it's nothing to do with ENS. The error message should at least mention the most probable cause, and ideally put that front and center. I'm not saying it shouldn't mention ENS, but if that's only one relatively unlikely cause of the error, then the message should reflect the balance of probabilities. Furthermore, it's not at all clear what Thanks again! |
Hello, I think, that I got quite same error: |
@dosjcq Looks like you are passing in |
@ricmoo, Thank you for your answer, I will try |
I also got the same error, I think the issue was not assigning contract address properly there should be no space in " ", write correct address and it'll get resolved :) |
@dosjcq not sure if this is particularly relevant for you but something like this might help:
|
Hello, I am receiving the same error.
I want to run these functions from a node js code. I checked: my address is correct. |
@kuabhish please include the entire error; the error indicates what was passed in. Use a console.log to make sure it is what you expect too. :) |
@kuabhish the error says the value passed in is |
I solved this issue.. turns out we were using it before the address was actually defined, so the fault was ours.. hope this helps.. a little magic with React and problem went away! |
Can someone help me, I read the whole thread, and I couldn't solve the problem. Error: invalid contract address or ENS name (argument="addressOrName", value=undefined, code=INVALID_ARGUMENT, version=contracts/5.6.2) Source 87 | const key = simpleCrypto.decrypt(cipherHH)
|
This is the problematic line. const contract = new ethers.Contract(hhnft, NFT, wallet); If you console log hhnft you should see that it's undefined. |
Error: invalid address or ENS name (argument="name", value=undefined, code=INVALID_ARGUMENT, version=contracts/5.6.2) |
Apparently you get this error message if you specify the contract call value in the beginning of the params, instead of in the end. When I do this: await contract.randomPayableFunc({value: 0.1}, arg1, arg2) I get Error: invalid address or ENS name (argument="name", value=undefined, code=INVALID_ARGUMENT, version=contracts/5.6.2) But when I do await contract.randomPayableFunc(arg1, arg2, {value: 0.1}) it works fine. Leaving this up here to help people in the future because it's easy to start looking at other things when getting this error message :) |
Of course! The order of parameters passed into a method matter in JavaScript. Otherwise how would it know which parameter is what? :p |
hello! i'm trying to send a payment through metamask on a web app built with react and am still facing the same issue: invalid address (argument="address", value=null, code=INVALID_ARGUMENT, version=address/5.7.0) not sure what's the issue / how to resolve it? would appreciate any input! thanks |
@wmlimanto it means somewhere you are passing null into a function needs an address. You are also using an ancient version of ethers. Try upgrading too, which may resolve your issue. |
@ricmoo thanks for getting back to me! i just checked and i'm on ethers v5.7.1, which should be the latest version if i'm not mistaken? not sure where you are referring to that i need to pass the address, if you don't mind looking at my code:
thanks so much! |
@wmlimanto check your stack trace, it will give you the exact line number that is the problem. My guess is that addr is null. Add a console.log to the top of your function. |
@ricmoo yup seems like you're right - console.log({ ether, addr }) is telling me that both values are null. trying to debug this issue now, appreciate your help! hope to update on a solution soon |
Error: index.ts:269 Uncaught (in promise) Error: invalid address or ENS name (argument="name", value=undefined, code=INVALID_ARGUMENT, version=contracts/5.7.0)
|
Hi there guys, i am getting the same error index.ts:269 Uncaught (in promise) Error: resolver or addr is not configured for ENS name (argument="name", value="", code=INVALID_ARGUMENT, version=contracts/5.7.0) This is my code export const ADDRESS = "0x1Cb0DFD5208823F08516E4Aa0CDc4b04F2d6a88c" ` //* Set the smart contract and provider to the state
}, []); any solutions? |
@laespinaworld I understand that you are doing NFT card game tutorial. Thank you so much. |
Did anyone finally figured it out ? |
I recently submitted PR #3774 - while it may not help with this particular issue where the cryptic error is typically thrown while trying to resolve an empty or
when using this PR, it will prepend the above error with something like the following:
which makes it clear exactly which parameter was set to TBH, I'm still confused why it wouldn't be easy to add a similar |
Hi! I run this code in browser, and can't catch promise rejection.
Important: I added await before getContract,however in typings you return Contract, not Promise but the code throw promise rejection!
Code:
let vault;
try {
vault = (await ethers.ContractFactory.getContract(
CONTRACT_ADDRESS,
vaultJson.abi,
signer
) as unknown) as Vault;
} catch (e) {
console.log("Error getting contract");
return;
}
Expected behavior:
Rejection in getContract would be caught in try-catch block
Real outcome:
Unhandled Rejection (Error): resolver or addr is not configured for ENS name (argument="name", value="", code=INVALID_ARGUMENT, version=contracts/5.0.8)
The text was updated successfully, but these errors were encountered: