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 Express production server error handler #6627
Conversation
Size Change: +119 B (0%) Total Size: 2.37 MB
ℹ️ View Unchanged
|
⚡️ Lighthouse report for the changes in this PRLighthouse tested 2 URLs Report for Article
Report for Front
|
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.
🤦♂️ it was me. This comment is much more explicit about why the four arguments are required!
Many of the functions prefixed with render are in fact `express` handlers, so their signature and name have been updated to reflect that.
What does this change?
When running a prod build and Cypress tests locally I noticed the following repeated error in the server terminal output:
This is caused by not declaring all parameters to the
handleError
function inprod-server.ts
which means Express will not recognise the function as an error handler as per the docs:https://expressjs.com/en/api.html#:~:text=Error%2Dhandling%20middleware%20always,see%3A%20Error%20handling
Why