0

Recently I've made a container out of my app, which used to work fine in a normal environment with an infura node. This is the code that's causing problems inside of the Docker container. I'm new to docker and it might be a port thing, I've exposed port 80 and 443.

const provider = new Web3.providers.HttpProvider('https://rinkeby.infura.io/v3/KEY');
const web3 = new Web3(provider);

This is the error output of docker logs:

/usr/src/app/node_modules/web3/lib/web3/httpprovider.js:102
throw errors.InvalidResponse(request.responseText);
^

Error: Invalid JSON RPC response: undefined
at Object.InvalidResponse (/usr/src/app/node_modules/web3/lib/web3/errors.js:38:16)
at HttpProvider.send (/usr/src/app/node_modules/web3/lib/web3/httpprovider.js:102:18)
at RequestManager.send (/usr/src/app/node_modules/web3/lib/web3/requestmanager.js:58:32)
at Eth.get [as blockNumber] (/usr/src/app/node_modules/web3/lib/web3/property.js:107:62)
at Object.<anonymous> (/usr/src/app/transactions.js:77:26)
at Module._compile (internal/modules/cjs/loader.js:721:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)

I'll say this again but my app works perfectly except for in a docker container.

Your Answer

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

Browse other questions tagged or ask your own question.