hypothesis / lms

LTI app for integrating with learning management systems
BSD 2-Clause "Simplified" License
46 stars 14 forks source link

4xx errors from JSTOR API on assignment launch result in incorrect `mode` config in the frontend #6448

Open robertknight opened 1 month ago

robertknight commented 1 month ago

The JSTOR assignment at https://hypothesis.instructure.com/courses/125/assignments/2852 is currently failing to load due to an authorization error when we fetch the PDF from their API. See https://hypothesis.sentry.io/issues/4464064387.

What should happen in this situation is that some kind of error is presented to the user. Instead the view navigates to https://lms.hypothes.is/app/null and a "Page not found" message is being shown. This URL and message is being shown because the backend is setting an invalid value for mode in the frontend configuration:

{
    "api": {
        "authToken": "Bearer ..."
    },
    "canvas": {
    },
    "debug": {
        "tags": [
            "role:instructor"
        ],
        "values": {
        }
    },
    "dev": false,
    "mode": null
}

Instead the configuration should be something that causes the frontend to render an error dialog.

Slack thread: https://hypothes-is.slack.com/archives/C02T75RKBTK/p1721106307351849?thread_ts=1721067738.484689&cid=C02T75RKBTK