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

Batch. Request invalid request #6164

Closed
ppegu opened this issue Jun 7, 2023 · 6 comments
Closed

Batch. Request invalid request #6164

ppegu opened this issue Jun 7, 2023 · 6 comments
Assignees
Labels
4.x 4.0 related Bug Addressing a bug

Comments

@ppegu
Copy link

ppegu commented Jun 7, 2023

const batch = new web3.BatchRequest();

const request1 = {
  jsonrpc: "2.0",
  id: 10,
  method: "eth_getBalance",
  params: ["0x*****", "latest"],
};

batch.add(request1);

const responses = await batch.execute();

console.log(responses);

innerError: { code: -32600, message: 'invalid request' },

@Muhammad-Altabba
Copy link
Contributor

Hello @ppegu ,
Thanks for opening an issue. However, could you please let us know what is the version you are using? And the exact value for the request1 params. And the full error message with its stack trace.
Thanks,

@jdevcs
Copy link
Contributor

jdevcs commented Jun 7, 2023

In 4.x if there is 1 request added in batch, the bug is here asjsonRpc.isBatchRequest(request)returns false and its processed request output is :

{
  jsonrpc: "2.0",
  id: "2902cc2e-7be0-46cd-bb55-e53c607e29fb",
  method: undefined,
  params: undefined,
}

in case if there are > 1 requests added, it works fine,

@jdevcs jdevcs added 4.x 4.0 related Bug Addressing a bug labels Jun 7, 2023
@ppegu
Copy link
Author

ppegu commented Jun 7, 2023

Oo okay Thanks

@ppegu ppegu closed this as completed Jun 7, 2023
@ppegu ppegu reopened this Jun 7, 2023
@jdevcs
Copy link
Contributor

jdevcs commented Jun 7, 2023

@ppegu Thanks for testing 4.x,
If you have time you may open a PR for it or one of our team member will fix it.

@ppegu
Copy link
Author

ppegu commented Jun 7, 2023

Sure i will. Thanks Again

@luu-alex luu-alex self-assigned this Jun 7, 2023
@luu-alex
Copy link
Contributor

luu-alex commented Jun 7, 2023

PR created, thank you for finding this! #6166

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x 4.0 related Bug Addressing a bug
Projects
None yet
Development

No branches or pull requests

4 participants