Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Invalid JSON RPC response: "" #5138

Closed
1 task done
Ciao-2 opened this issue Jun 16, 2022 · 3 comments
Closed
1 task done

Error: Invalid JSON RPC response: "" #5138

Ciao-2 opened this issue Jun 16, 2022 · 3 comments
Labels
1.x 1.0 related issues Bug Addressing a bug Stale Has not received enough activity

Comments

@Ciao-2
Copy link

Ciao-2 commented Jun 16, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Error: Invalid JSON RPC response: ""

web3.eth.getTransactionReceipt(hash).then(req => {

}).catch(e => {
Logger.error(e.message)
})

Expected Behavior

web3.eth.getTransactionReceipt(hash).then(req => {

}).catch(e => {
Logger.error(e.message)
})

Steps to Reproduce

random occurrence

Web3.js Version

1.7.3

Environment

Anything Else?

No response

@Ciao-2 Ciao-2 added the Bug Addressing a bug label Jun 16, 2022
@nikoulai nikoulai added the 1.x 1.0 related issues label Jun 17, 2022
@jdevcs
Copy link
Contributor

jdevcs commented Jun 20, 2022

@Ciao-2 are you using reliable provider, may be check provider directly?
curl --data '{"jsonrpc":"2.0","method": "eth_getTransactionReceipt", "params": ["YOUR_TX_HASH"], "id": 0}' -H "Content-Type: application/json" localhostOR_YOUR_PROVIDER:8545

@SaulMoonves
Copy link

SaulMoonves commented Jun 26, 2022

This is happening to me as well on 1.7.4. I can do the curl request and it works fine but i get the error above when i try it from web3.js. This is tested on a production server where another application on web3.js 0.xx is working perfectly so it is definitely not the server or the connectivity.

I added some logging statements to "web3-providers-http" and I have tracked down the problem. The xmlhttprequest upload content type is set to: "text/plain;charset=UTF-8" instead of "application/json". I reproduced the error in curl by setting the accept header to that.

specifically here is what i added:

console.debug("CONTENT-TYPE", request.upload._contentType);

and I can see it's: "text/plain;charset=UTF-8"

I don't know where that value is coming from and I haven't figured out how to fix it but maybe someone with more familiarity with the code will know.

node.js: v18.4.0

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.

@github-actions github-actions bot added the Stale Has not received enough activity label Aug 26, 2022
@github-actions github-actions bot closed this as completed Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x 1.0 related issues Bug Addressing a bug Stale Has not received enough activity
Projects
None yet
Development

No branches or pull requests

4 participants