I get this error when i try to run my script on the rinkeby network: Error HH8: There's one or more errors in your config file:

  • Invalid value undefined for HardhatConfig.networks.rinkeby.url - Expected a value of type string.


module.exports = {
  solidity: '0.8.1',
  networks: {
    rinkeby: {
      url: process.env.STAGING_ALCHEMY_KEY,
      accounts: process.env.PRIVATE_KEY,

.env File

  • It is possible , you don't have .env file or don't have PRIVATE_KEY = "your private key" in your .env file
    – Sol_dev
    Commented Jun 9, 2022 at 16:54
  • I have a .env file with my private key and Alchemy API key. Commented Jun 9, 2022 at 20:40

1 Answer 1


The problem was from the .env file. The prefix process.env in front of the environment variable isn't needed. I removed it leaving just the STAGING_ALCHEMY_KEY and PRIVATE_KEY variables and their values.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.