openlibrary icon indicating copy to clipboard operation
openlibrary copied to clipboard

`/developers/routes` displays internal error message

Open jimchamp opened this issue 1 year ago • 8 comments

Problem

The content of the /developers/routes page cannot be rendered due to an internal error. The json.dumps() call, here, is failing with a TypeError - '<' not supported between instances of 'str' and 'NoneType'.

This page is referenced throughout our wiki.

See: https://openlibrary.org/developers/routes

https://github.com/internetarchive/openlibrary/blob/1547af51e046dce80ddaf060f0783e01ee080798/openlibrary/plugins/openlibrary/code.py#L209-L227

This is happening because some keys are None

dct: {None: <class 'openlibrary.plugins.openlibrary.lists.lists'>, 'json': <class 'openlibrary.plugins.openlibrary.lists.lists_json'>, 'yml': <class 'openlibrary.plugins.openlibrary.lists.lists_yaml'>}
Image

Solution

removing sort_keys=True, should fix

https://github.com/internetarchive/openlibrary/blob/1547af51e046dce80ddaf060f0783e01ee080798/openlibrary/plugins/openlibrary/code.py#L223C13-L223C28

Reproducing the bug

  1. Go to /developers/routes
  • Expected behavior: The page loads without error
  • Actual behavior: The page displays an error

Context

  • Browser (Chrome, Safari, Firefox, etc): Any
  • OS (Windows, Mac, etc): Any
  • Logged in (Y/N): N
  • Environment (prod, dev, local): dev / prod

Breakdown

Requirements Checklist

  • [ ]

Related files

Stakeholders


Instructions for Contributors

  • Please run these commands to ensure your repository is up to date before creating a new branch to work on this issue and each time after pushing code to Github, because the pre-commit bot may add commits to your PRs upstream.

jimchamp avatar Sep 11 '25 17:09 jimchamp

Hello! I'd like to work on this issue. Would that be okay?

seohyeonlee2020 avatar Sep 13 '25 11:09 seohyeonlee2020

Hi, I would like to work on this issue!

ivanMehvish avatar Sep 15 '25 09:09 ivanMehvish

First come, first served. @seohyeonlee2020, you are assigned. Please reach out if you have any questions, and be sure to manually test your work before opening a PR.

jimchamp avatar Sep 15 '25 16:09 jimchamp

Thank you!

seohyeonlee2020 avatar Sep 17 '25 03:09 seohyeonlee2020

Hi @jimchamp, I noticed this issue is currently assigned, but I would also love to work on it. If @seohyeonlee2020 is not actively working, could I take it up or help out?

Gurleen-kansray avatar Sep 20 '25 06:09 Gurleen-kansray

@Gurleen-kansray I am working on this issue.

seohyeonlee2020 avatar Sep 20 '25 06:09 seohyeonlee2020

@seohyeonlee2020 Thanks for letting me know! Good luck with the fix. Let me know if you need any help along the way.

Gurleen-kansray avatar Sep 20 '25 06:09 Gurleen-kansray

@jimchamp I just created a PR: https://github.com/internetarchive/openlibrary/pull/11292

seohyeonlee2020 avatar Sep 21 '25 09:09 seohyeonlee2020