Trying to deploy the newly created contract into rinkeby test network but got struck with the below error. Please check the code, error message and package.json details below.
const HDWalletProvider = require('truffle-hdwallet-provider');
const Web3 = require('web3');
const {interface, bytecode} = require('./compile');
const provider = new HDWalletProvider(
'frog almost employ roast protect host citizen festival rural alone document misery',
'https://rinkeby.infura.io/v3/560e70f3ebfc4f628a53f4143b9460fd'
);
const web3= new Web3(provider);
const deploy = async () => {
const accounts = await web3.eth.getAccounts();
try {
const contractDeployment = await new web3.eth.Contract(JSON.parse(interface))
.deploy({ data: '0x'+ bytecode, arguments: ['Hi there! I am inside Rinkeby'] })
.send({from: accounts[0] });
console.log(contractDeployment.options.address);
} catch (error) {
console.log(error);
}
};
deploy();
======================================================================
Error:
(node:58876) UnhandledPromiseRejectionWarning: Error: Subscriptions are not supported with the CustomProvider.
at CustomProvider.subscribe (C:\BlockChain\node_modules\web3-providers\dist\web3-providers.cjs.js:1139:13)
at NewHeadsSubscription.subscribe (C:\BlockChain\node_modules\web3-core-subscriptions\dist\web3-core-subscriptions.cjs.js:52:43)
at NewHeadsWatcher.watch (C:\BlockChain\node_modules\web3-core-method\dist\web3-core-method.cjs.js:180:110)
at C:\BlockChain\node_modules\web3-core-method\dist\web3-core-method.cjs.js:50:31
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
(node:58876) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:58876) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Error: Invalid JSON RPC response: ""
=======================================================================
Package.Json
"dependencies": {
"ganache-cli": "^6.2.3",
"mocha": "^5.2.0",
"solc": "^0.4.25",
"truffle-hdwallet-provider": "0.0.6",
"web3": "^1.0.0-beta.37"