next js window is not defined code example Example: referenceerror next is not defined Make Sure next is added to your parameters (req, res, next)