Search code examples
yamlamazon-elastic-beanstalkethereumsmartcontractsethers.js

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


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.


Solution

  • 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"