I have a network_id error when migrating to the Rinkeby test net
I am following this tutorial, but when it comes time to migrate my smart contract to the Rinkeby test net (truffle migrate –network rinkeby) I am getting the following error:
You must specify a network_id in your 'rinkeby' configuration in order to use this network.
What is confusing is that I have definitely specified a network id in my truffle-config.js file.
This is where I create the ‘rinkeby’ network:
require("dotenv").config();
const HDWalletProvider = require('@truffle/hdwallet-provider');
module.exports = {
networks: {
development: {
host: "127.0.0.1", // Localhost (default: none)
port: 7545, // Standard Ethereum port (default: none)
network_id: "*" // Any network (default: none)
},
rinkeby: {
provider: () => new HDWalletProvider(process.env.MNEMONIC,
`https://rinkeby.infura.io/v3/${process.env.INFURA_API_KEY}`),
network_id: 4, // Ropsten's id
gas: 5500000, // Ropsten has a lower block limit than mainnet
confirmations: 2, // # of confs to wait between deployments. (default: 0)
timeoutBlock: 200, // # of block before a deployment times out (minimum/default: 50)
skipDryRun: true // Skip dry run before migrations? (default: false for public nets)
},
},
By the way, I am using an Infura endpoint and HD Wallet Provider. Any help would be greatly appreciated, because I haven’t been able to find anywhere where this particular situation is addressed.