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

JSON.parse RPC response only after receiving all chunks #384

Closed
wants to merge 2 commits into from

Conversation

onetom
Copy link

@onetom onetom commented Dec 28, 2018

Problem

The following error was thrown, when deploying contracts over an IpcProvider:

        JSON.parse (<anonymous>)
        Socket.<anonymous> (node_modules/ethers/providers/ipc-provider.js:56:34)

Solution

Buffer the RPC server's response chunks and parse them once they all arrive.
The arrival of the complete response is signalled by the RPC server requesting to end the connection.

A slight enhancement was added to the error reporting too, to show the response which couldn't be JSON.parsed.

@ricmoo ricmoo self-assigned this Jan 21, 2019
@ricmoo ricmoo added the on-deck This Enhancement or Bug is currently being worked on. label Jan 21, 2019
ricmoo added a commit that referenced this pull request Jan 23, 2019
@ricmoo
Copy link
Member

ricmoo commented Jan 23, 2019

This has been fixed, please try it out and let me know if you still experience any problems. The test cases you provided are not in the test suite right now, but will likely be included in the future. :)

Thanks! :)

@ricmoo ricmoo closed this Jan 23, 2019
@ricmoo ricmoo added bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published. and removed on-deck This Enhancement or Bug is currently being worked on. labels Sep 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants