Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Error object not properly filled out when submitting eth_subscribe request. #120

Closed
MicahZoltu opened this issue Mar 7, 2017 · 5 comments
Assignees

Comments

@MicahZoltu
Copy link

When I send the following request over the JSON-RPC:

{
	id: 1,
	jsonrpc: "2.0",
	method: "eth_subscribe",
	params: [ "newHeads", {} ]
}

Expected (per spec):

{
	...
	error: {
		code: -32601,
		message: "Method not found"
	}
}

Actually received:

{
	...
	"error":{
		"code":-32000,
		"message":"Error: HTTP Error: 405 on eth_subscribe\n    at Object.callback (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/scripts/background.js:105443:18)\n    at cbOnce (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/scripts/background.js:106012:21)\n    at loadFunc (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/scripts/background.js:106079:16)\n    at XMLHttpRequest.readystatechange (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/scripts/background.js:106018:13)"
	}
}
@danfinlay
Copy link
Contributor

It looks to me like you're maybe hitting a managed RPC provider like Infura, which does not currently support stateful requests like eth_subscribe.

This is why the Filter Subprovider exists, it essentially polyfills this feature into a client-side polling layer.

@danfinlay
Copy link
Contributor

If you confirm you're hitting Infura, we can close this issue.

@MicahZoltu
Copy link
Author

MicahZoltu commented Mar 7, 2017

I'm not sure how to tell. I load my dApp in a webpage with the MetaMask extension installed and then send a JSON-RPC request using window.web3.currentProvider.sendAsync(payload, callback) with the payload I linked above. callback is then called with a response that looks like the one I referenced in the issue description.

Also, note that my expectation here isn't that eth_subscribe actually works. My expectation is only that I get a proper error message in response to it (-32601/Method not found).

If this is an Infura problem and MetaMask is just blindly forwarding the error to me, how does one go about reporting a bug to them?

@danfinlay
Copy link
Contributor

Oh I see now. This is an issue with how provider-engine forms and forwards error codes from an RPC, relative to the JSON RPC spec.

We would need to write a comprehensive mapping of RPC error codes to JSON RPC expected output, right about here.

@tinybike
Copy link

tinybike commented May 4, 2018

This has re-surfaced over the past week or so. (Or at least, that's when I first noticed it; it's possible it's been around much longer and just eluded my attention.) I've been getting back a success (?) response (specifically, 0xb) from MetaMask when I try to send eth_subscribe requests, instead of the expected "Method not found" error. Pinging @kumavis @danfinlay in case there's a regression on your end!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants