This error appeared for me when upgrading the app to Express v5.
As explained by others, when using Express v5 you should replace routes like:
app.use('*', xxxx);
to
app.use(/(.*)/, xxxx);