I have deployed my dapp front end and backend on Digital Ocean. On running the server.js I am getting below error

(node:30490) UnhandledPromiseRejectionWarning: Error: Invalid JSON RPC response: ""

Below settings in my server.js code use to work fine on my local Ganache,

const provider = new Web3.providers.HttpProvider("http://localhost:8545");

I suspect I need to make changes in web3 provider to make it compatible to run on DigitalOcean but cannot figure out them, please help...

  • Since you are not planning to install a geth node in your server I'd recommend to register with Infura.io and obtain a url to connect. – Ismael Aug 28 '18 at 19:41

If you are trying to access the dapp from your local environment, change the localhost to your rpc provider node ip address.

const provider = new Web3.providers.HttpProvider("http://node_ip_address:8545");
  • I want to run my dapp (front end and server) on Rinkeby Network. In the server.js file I have created event listeners for solidity events. Please suggest how can I implement that. – tanmay Aug 25 '18 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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