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

(rpc-server): Failed to serialize JsonRpcError #343

Open
khorolets opened this issue Aug 19, 2024 · 0 comments
Open

(rpc-server): Failed to serialize JsonRpcError #343

khorolets opened this issue Aug 19, 2024 · 0 comments
Assignees

Comments

@khorolets
Copy link
Member

It's been happening for a long time.

During the last resharding some weird [still unresolved] issue happened on the nearcore regarding the hot/cold storage data transition. And some pieces of the data is missing from a Trie.

This results in an archival node responding with an error similar to

StorageError(MissingTrieValue(TrieStorage, 5pU46FzKxQz7wm3y4QaroG1pGFJeM9SGXFggWHXnD4JH))"

For some reason ReadRPC doesn't know how to serialize this error. We face this errors in those cases when we proxy requests to the native JSON RPC nodes (query.call_function on the *.poolv1.near).

We need to somehow empower ReadRPC with the serialization abitlities around this particular error type to be more clear to the users, since it's hard to understand what does "Failed to serialize JsonRpcError` means.

Step to reproduce

Request (HttPie)

http post https://archival-rpc.mainnet.near.org/ jsonrpc=2.0 id=qwe method=query params:='{                                                       
         "request_type": "call_function",
         "account_id": "astro-stakers.poolv1.near",
         "method_name": "get_accounts",
         "args_base64": "eyJmcm9tX2luZGV4IjogMCwgImxpbWl0IjogMTAwfQ==",
         "block_id": 123522710
     }'

The response is

{
    "error": {
        "cause": {
            "info": {
                "error_message": "Failed to serialize JsonRpcError"
            },
            "name": "INTERNAL_ERROR"
        },
        "code": -32000,
        "data": "Failed to serialize JsonRpcError",
        "message": "Server error",
        "name": "INTERNAL_ERROR"
    },
    "id": "qwe",
    "jsonrpc": "2.0"
}

But has to be

{
    "error": {
        "cause": {
            "info": {
                "error_message": "StorageError(MissingTrieValue(TrieStorage, 5pU46FzKxQz7wm3y4QaroG1pGFJeM9SGXFggWHXnD4JH))"
            },
            "name": "INTERNAL_ERROR"
        },
        "code": -32000,
        "data": "The node reached its limits. Try again later. More details: StorageError(MissingTrieValue(TrieStorage, 5pU46FzKxQz7wm3y4QaroG1pGFJeM9SGXFggWHXnD4JH))",
        "message": "Server error",
        "name": "INTERNAL_ERROR"
    },
    "id": "qwe",
    "jsonrpc": "2.0"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants