lbryio / lbryio/lbry-sdk

handle malformed json requests more gracefully

Open
#2,525 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: jsonrpc priority: low type: bug
Dominant language
Python
Stars
7.2k
Forks
493
PR merge metrics
No merged PRs in 30d

Description

Thanks to @sayplastic for spotting and suggesting we do this. An invalid request like below, we could provide a better error message.

curl -d '{"method": "account_balance", "params": {"wallet_id": "lbrytv-id.1596870.wallet"}' http://localhost:5579/

results in:

500 Internal Server Error
Server got itself in trouble

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the malformed request with the curl example against the HTTP server and trace how the invalid JSON is handled. Update the request error path so malformed JSON produces a useful client-facing error rather than a 500 response, then verify the behavior with the same request.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.