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',
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] });

    } catch (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: ""
  "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"
  • Infura only supports events through websockets endpoints.
    – Ismael
    Commented Mar 10, 2019 at 7:35
  • @Ismael I tried to replace the provider to provider = new Web3.providers.WebsocketProvider('wss://rinkeby.infura.io/ws/v3/560e70f3ebfc4f628a53f4143b9460fd'); But I am not now even able to fetch account for deploying the contract. Any idea?
    – Darey
    Commented Mar 11, 2019 at 16:40

1 Answer 1


This sounds like this known issue with beta.48: https://github.com/ethereum/web3.js/issues/2462

Maybe try downgrading web3.js to beta.37, that seems to be the most stable option at the moment.

  • I already have the beta.37 version
    – Darey
    Commented Mar 10, 2019 at 6:18

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