You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Subscribing to pending transactions gives an error and exits the program while using IPC connection.
Expected behavior
Subscribing to new pending transaction (web3.eth.subscribe('pendingTransactions')) is expected to return a json response with a txhash of new transaction.
Actual behavior
It returns a json response but it terminates the execution of the program with an error (see in Error logs section the actual error message).
I actually tried to debug the code and it seems that it fails here:
if (!isObject(response)) {
response = JSON.parse(response);
}
while trying to parse the JSON response that comes from the IPC pipe. It seems that in the variable response it appears not only the JSON response of the pending transaction but also the first response that gives the subscription ID when starting the subscription to the node so it fails to parse that object to json.
(This is my interpretation, it can be another thing but hope this helps to fix the problem but if it is this, maybe other subscription types -like block headers- will fail as well).
Steps to reproduce the behavior
Import web3
Set IPC Provider
Subscribe to new pending transactions.
Error Logs
SyntaxError: Unexpected token { in JSON at position 71
at JSON.parse ()
at IpcProvider.onMessage (/node_modules/web3-providers/dist/web3-providers.cjs.js:285:25)
at IpcProvider.onMessage (/node_modules/web3-providers/dist/web3-providers.cjs.js:551:71)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at Pipe.onread (net.js:607:20)
Versions
web3.js: 1.0.0-beta.50
nodejs: v 8.10.0
browser: -
ethereum node: geth v1.8.23-stable-c9427004
Regards!
The text was updated successfully, but these errors were encountered:
Description
Subscribing to pending transactions gives an error and exits the program while using IPC connection.
Expected behavior
Subscribing to new pending transaction (web3.eth.subscribe('pendingTransactions')) is expected to return a json response with a txhash of new transaction.
Actual behavior
It returns a json response but it terminates the execution of the program with an error (see in Error logs section the actual error message).
I actually tried to debug the code and it seems that it fails here:
while trying to parse the JSON response that comes from the IPC pipe. It seems that in the variable response it appears not only the JSON response of the pending transaction but also the first response that gives the subscription ID when starting the subscription to the node so it fails to parse that object to json.
(This is my interpretation, it can be another thing but hope this helps to fix the problem but if it is this, maybe other subscription types -like block headers- will fail as well).
Steps to reproduce the behavior
Error Logs
SyntaxError: Unexpected token { in JSON at position 71
at JSON.parse ()
at IpcProvider.onMessage (/node_modules/web3-providers/dist/web3-providers.cjs.js:285:25)
at IpcProvider.onMessage (/node_modules/web3-providers/dist/web3-providers.cjs.js:551:71)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at Pipe.onread (net.js:607:20)
Versions
Regards!
The text was updated successfully, but these errors were encountered: