michaelhly / solana-py

Solana Python SDK
https://michaelhly.github.io/solana-py
MIT License
1.04k stars 273 forks source link

WebSocket error when data is larger than RPC limit #360

Open mfrager opened 1 year ago

mfrager commented 1 year ago

Websocket Error:

error: data too large for bs58 encoding

Raw Websocket Message:

{"jsonrpc":"2.0","method":"programNotification","params":{"result":{"context":{"slot":216302856},"value":{"pubkey":"CyLqCick4VJYTG5id9EbU1RMxCXt9q5C51ZAnBJWWc5p","account":{"lamports":2679600,"data":"error: data too large for bs58 encoding","owner":"CTLGp9JpcXCJZPqdn2W73c74DTsCTS8EFEedd7enU8Mv","executable":false,"rentEpoch":0}}},"subscription":8491861}}

Python Error Generated:

future: <Task finished name='Task-5' coro=<websocket_listener() done, defined at /zzz/solana_tracker.py:153> exception=SerdeJSONError('a list or single element')> Traceback (most recent call last): File "/zzz/solana_tracker.py", line 160, in websocket_listener async for idx, msg in enumerate(websocket): File "/usr/local/lib/python3.10/site-packages/asyncstdlib/builtins.py", line 620, in enumerate async for item in item_iter: File "/usr/local/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 497, in aiter yield await self.recv() File "/usr/local/lib/python3.10/site-packages/solana/rpc/websocket_api.py", line 108, in recv return self._process_rpc_response(cast(str, data)) File "/usr/local/lib/python3.10/site-packages/solana/rpc/websocket_api.py", line 346, in _process_rpc_response parsed = parse_websocket_message(raw) solders.SerdeJSONError: a list or single element

kevinheavey commented 1 year ago

Does it work if you use base64 instead?

mfrager commented 1 year ago

Yes