Waiting for the async task of the middleware to complete before rendering the pages...
Making the async task work as expected (the callback needs to send null as the error)