-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(api): fix media route timeout #1170
Conversation
55bd0f5
to
373203d
Compare
7afd9d3
to
aa0f9c7
Compare
router.use(catchNonExistentRoutesMiddleware) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not put this as the terminating middleware in our server.js
? this would allow us to catch all missing routes and to return a sensible response
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a terminating middleware already exists at server.js
where our overall error handler resides.
the problem exists when a subrouter captures a group and does not handle it, causing a timeout.
do note that some of our routes fall through while others dont, so i couldnt append this at the end of all subrouters because that broke quite a number of functionality within the cms, and the manual test space for such a pr will be unreasonably large. stance here will be to monitor for 5xx errors and then fix them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually that's weird because i always thought if the subrouter doesn't capture the route, it should fall over to the next one.
ie, if subrouter A captures /about/a
and i get a request with /about/b
, it should fall to the next router in the stack.
this isn't very important given that we assume most users are calling from the frontend but it is weird tho
Problem
We had an issue where a request such as "media/images%20blah/pages" timeing out, see incident here. 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
next()
to every subrouterBreaking Changes
Tests