OriginProtocol / OriginProtocol/origin-website

API Error handling

Open
#578 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
HTML
Stars
41
Forks
49
PR merge metrics
No merged PRs in 30d

Description

Token data is stale according to Kay. While investigating this, I saw the following in the logs. Perhaps this is preventing updates of token data.

Traceback (most recent call last):
  File "logic/scripts/update_token_insight.py", line 442, in <module>
    token_stats.compute_ogn_stats()
  File "/app/logic/scripts/token_stats.py", line 280, in compute_ogn_stats
    ogn_staked_data = fetch_onchain_staking_stats_by_duration()
  File "/app/logic/scripts/token_stats.py", line 92, in fetch_onchain_staking_stats_by_duration
    response = raw_json.json()
  File "/app/.heroku/python/lib/python2.7/site-packages/requests/models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "/app/.heroku/python/lib/python2.7/json/__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "/app/.heroku/python/lib/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/app/.heroku/python/lib/python2.7/json/decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

The README has an example for ./logic/scripts/token_stats.py, but that script is not being run with task scheduler on heroku. Not clear yet if that's related.

Contributor guide

No contributing guide indexed for this repository

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 with the traceback in logic/scripts/token_stats.py, especially fetch_onchain_staking_stats_by_duration(), and trace its call from logic/scripts/update_token_insight.py. Compare the README example for token_stats.py with the Heroku task scheduler configuration. Done means identifying whether the JSON error or missing scheduled task prevents token updates and documenting or fixing the confirmed cause.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, blockchain
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.