Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(api): fix media route timeout (#1170)
## Problem We had an issue where a request such as "media/images%20blah/pages" timeing out, see incident [here](https://opengovproducts.slack.com/archives/CK68JNFHR/p1708651983715799). while we do have an overall catch all in our main router, there are quite a number of calls in our subrouter that fails. ## Solution for the media subrouter, this should return a 404. this is not applied across all the routes as some of the routes depend on the fall through behaviour to function. therefore, this pr is only scoped to return only for the media subrouter # Other solutions that did not work 1. adding a `next()` to every subrouter 2. adding an error handler to every subrouter such that if subrouter captures a group and does not handle it, an error should be thrown. unfortunately, this caused quite a number of functionality to break, rather this hotfix go in first while and revisit this when we get timeouts again **Breaking Changes** <!-- Does this PR contain any backward incompatible changes? If so, what are they and should there be special considerations for release? --> - [ ] Yes - this PR contains breaking changes - Details ... - [X] No - this PR is backwards compatible with ALL of the following feature flags in this [doc](https://www.notion.so/opengov/Existing-feature-flags-518ad2cdc325420893a105e88c432be5) ## Tests - [ ] Get call an authenticated request (ie you have assess to the site with the relevant valid cookie) to the backend ``` GET http://localhost:8081/v2/sites/kishore-test-dev-gh/media/images%2Fblah.png/pages ``` - [ ] Assert that you receive a res not found error rather than a timeout <img width="1211" alt="Screenshot 2024-03-04 at 8 21 16 AM" src="https://github.com/isomerpages/isomercms-backend/assets/42832651/a88d2115-d4fc-47d3-b264-fbb5b1138953">
- Loading branch information