-
Notifications
You must be signed in to change notification settings - Fork 4
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
Fallback from batch provider to singular provider #144
Conversation
Coverage report
Test suite run success31 tests passing in 5 suites. Report generated by 🧪jest coverage report action from 84ea4dd |
this.name = network.name; | ||
} catch (e) { | ||
//batch request error for filecoin | ||
if (e.message.includes('"message":"we can\'t execute this request"')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would only work for filecoin. Other RPC providers might do other things.
I think we should change this error handling. Maybe we can go off the http code or if its not a json rpc response
@@ -144,8 +144,7 @@ export class EthereumApi implements ApiWrapper<EthereumBlockWrapper> { | |||
this.chainId = network.chainId; | |||
this.name = network.name; | |||
} catch (e) { | |||
//batch request error for filecoin | |||
if (e.message.includes('"message":"we can\'t execute this request"')) { | |||
if ((e as Error).message.startsWith('Invalid response')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this check against an Ethers error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Invalid response \n' + JSON.stringify(result), |
This is how JsonRpcBatchProvider
class intercepts invalid responses
Description
With the ETH sdk we use the batch http provider by default. Some RPC endpoints don't support batch requests. We should instead fallback to using the singular provider if this happens
Fixes subquery#1941
Type of change
Please delete options that are not relevant.
Checklist