// catch 404 and forward to error handler
app.use(function (req, res, next) {
console.log('you have 404 on ', req.originalUrl);
next(createError(404));
});
app.use((err, req, res, next) => {
console.log('you have err on ', req.originalUrl, err);
if (err.status !== 403) return next();
res.send('403 error :: Invalid Token');
});
Use above code to debug where you make a mistake in my case one variable which is include in header is undefined after every load of any .JS file 🙂





![Cannot read property ‘toLowerCase’ of undefined [ERROR] An error occurred while running subprocess cordova.](https://blog.rahulbhutani.com/wp-content/uploads/2020/12/ionic-enable-xcode-permissions-banner-100x70.png)












