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
I am using muxrpc to communicate over a websocket from the browser to a local node process. (I am using browserify) When using the client in the browser, I am seeing this error when trying to call an rpc method: Uncaught Error: data must be a buffer, was: {}.
It looks like pull-reader throws this error here when checking if the response data is a buffer. In the browser, these responses are coming back as Blob objects, not buffers (not sure why though). The code below works fine when used serverside, so my hunch is the browser is doing some type of coercion on the data to convert it to a Blob. I ran a quick test to see if converting the blob to a buffer works and it seems too. Could a check be added to test if if (data instanceof Blob) convertBlobToBuf(data)?
Or is there a better way to handle this. I can handle a PR but not sure which module a check like this should go, and also, maybe I'm just doing something wrong since I haven't seen any other GH issues reference this problem. @arj03 You are doing quite a bit on the browserside, have you ever seen this error?
Reproduce with this code.
client.js (browserify client.js -o bundle.js)
I am using
muxrpc
to communicate over a websocket from the browser to a local node process. (I am using browserify) When using the client in the browser, I am seeing this error when trying to call an rpc method:Uncaught Error: data must be a buffer, was: {}
.It looks like
pull-reader
throws this error here when checking if the response data is a buffer. In the browser, these responses are coming back as Blob objects, not buffers (not sure why though). The code below works fine when used serverside, so my hunch is the browser is doing some type of coercion on the data to convert it to a Blob. I ran a quick test to see if converting the blob to a buffer works and it seems too. Could a check be added to test ifif (data instanceof Blob) convertBlobToBuf(data)
?We could do it in this module on this line: https://github.com/pull-stream/pull-ws/blob/master/source.js#L31
Or is there a better way to handle this. I can handle a PR but not sure which module a check like this should go, and also, maybe I'm just doing something wrong since I haven't seen any other GH issues reference this problem. @arj03 You are doing quite a bit on the browserside, have you ever seen this error?
Reproduce with this code.
client.js (
browserify client.js -o bundle.js
)server.js
The text was updated successfully, but these errors were encountered: