Ethers.js gives "resolver or addr is not configured for ENS name"
Asked Answered
K

2

7

I have the following code:

const ethereumProvider = ethers.getDefaultProvider(ETHEREUM_RPC);

const contract = new ethers.Contract(
  CONTRACT_ADDRESS,
  abi,
  ethereumProvider,
);

The ethers package gives me the following error:

Error: resolver or addr is not configured for ENS name (argument="name", value="734574864865375122901309634679882622222228500042", code=INVALID_ARGUMENT, version=contracts/5.5.0)

I don't know where this number comes from. I never give this as an argument anywhere.

Also, this error only occurs when deployed on AWS Beanstalk.

Klotz answered 18/2, 2022 at 12:27 Comment(0)
K
5

Actually, the "weird number" was the decimal version of the smart contract address (which should be hexadecimal).

The hexadecimal to decimal conversion happened in the YAML file where I pass the environment variables because the value was a number and not a string.

option_settings:
  aws:elasticbeanstalk:application:environment:
    CONTRACT_ADDRESS=0x80ab79e5c36351Fb5DBe2b35E97f724EcA47AE4A

So I just needed to surround the value with double quotes:

option_settings:
  aws:elasticbeanstalk:application:environment:
    CONTRACT_ADDRESS="0x80ab79e5c36351Fb5DBe2b35E97f724EcA47AE4A"
Klotz answered 18/2, 2022 at 12:27 Comment(0)
S
10

I think this error is usually associated with the contract address being passed as parameter.

For me, I got the error because I was passing an empty string instead of a contract address.

Septicemia answered 27/6, 2022 at 19:20 Comment(0)
K
5

Actually, the "weird number" was the decimal version of the smart contract address (which should be hexadecimal).

The hexadecimal to decimal conversion happened in the YAML file where I pass the environment variables because the value was a number and not a string.

option_settings:
  aws:elasticbeanstalk:application:environment:
    CONTRACT_ADDRESS=0x80ab79e5c36351Fb5DBe2b35E97f724EcA47AE4A

So I just needed to surround the value with double quotes:

option_settings:
  aws:elasticbeanstalk:application:environment:
    CONTRACT_ADDRESS="0x80ab79e5c36351Fb5DBe2b35E97f724EcA47AE4A"
Klotz answered 18/2, 2022 at 12:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.