effect icon indicating copy to clipboard operation
effect copied to clipboard

JSON-RPC Serialization: Requests are never handled on the client

Open sharedRoutine opened this issue 2 months ago • 1 comments

What version of Effect is running?

@effect/rpc: "0.71.1"

What steps can reproduce the bug?

On RpcServers Response we encode based on the RpcSerialization, which in the case of JsonRPC turns

[{"_tag":"Exit","requestId":"18","exit":{"_tag":"Success","value":"some value"}}]

into

[
    {
        "jsonrpc": "2.0",
        "id": 18,
        "result": "some value"
    }
]

The next thing that's executing is run's on message handler on the client side which defaults to Effect.void for an unknown tag (which the response does not have).

Therefore JsonRPC Serialization results in requests never finishing because write is never called.

What is the expected behavior?

JsonRPC Serialization should be properly treated on the client side

What do you see instead?

Requests finish but client never knows about it

Additional information

No response

sharedRoutine avatar Oct 29 '25 12:10 sharedRoutine

Presumably because decode is never called on the client, instead the RAW JSON is used here

sharedRoutine avatar Oct 29 '25 12:10 sharedRoutine