biobankinguk / biobankinguk

monorepo for main Biobanking UK source

Home Page:https://docs.biobankinguk.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ› v4.x StatusCode Error pages don't load correctly

beforan opened this issue Β· comments

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When the application experiences a 500 Internal Server Error (for example; other codes may also cause this) with DeveloperErrorPages turned off, the app attempts to load a StatusCode error page at the route /Error.

It fails to find this route, and so instead renders a Custom 404 Error Page (and returns a 404 Status Code which is misleading in monitoring/logs) indicating the StatusCode error page was Not Found.

Expected Behavior

500 Errors (or in fact most non-specifically-handled status codes*) should cause a custom "Something went wrong" error page to render for the route that errored.

*expected specifically handled status codes are:

  • 404 (Not Found)
  • 403 (Forbidden)
  • 401 (Unauthorised) -> should redirect to login

Steps To Reproduce

Hard (and undesirable) to force a 500 error on a deployed environment, but it's possible with misconfiguration:

Here's the way I found it

  • Attempt to search on the homepage before the search index exists (i.e. not an empty index; not even configured) in Elastic Search.
  • This will cause the typeahead endpoint to fail with a 500, but the Browser's network tab will receive a 404 for the /Error route instead.

Environment

- OS: macOS Sonoma 14.2.1
- Browser: Edge 120.0.2210.144 (Official build) (arm64)

Anything else?

No response