Skip to content

RPC call returns HTTP 500 in case of data error #91

@denis-at-chainstack

Description

@denis-at-chainstack

Describe the bug
When the request body contains invalid data (method name for example), for some reason Filecoin node return HTTP 500 code together with JSON containing all info about the error, while many other protocols return HTTP 200 in this case (with similar error JSON).
Normally HTTP 500 means server-error, supposing the client will retry the same request later. So it doesn't look like a proper code for this case.

To Reproduce

Steps to reproduce:

  1. Run
    curl --location --request POST 'https://hyperspace.filfox.info/rpc/v0'
    --header 'Content-Type: application/json'
    --data-raw '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "Filecoin.WalletBalance",
    "params": []
    }
    '
  2. Check the HTTP status code in response

Fact result:
The HTTP code is 500

Expected behavior:
HTTP code should be 200

Version (run lotus --version):
Filecoin.NetVersion returns 19
Filecoin.EthProtocolVersion returns 0x13
sorry, don't have access to the client itself

Artefacts

The response body for the request from the example:
{"jsonrpc":"2.0","id":1,"error":{"code":-32602,"message":"wrong param count (method 'Filecoin.WalletBalance'): 0 != 1"}}

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions