I get Call to a member function checkAccess() on a non-object Error

I am using Yii 2 advanced application template and I have generated basic code using gii. I have set up user login and when opening an index page with gridview of a module, I get the following error:




PHP Fatal Error – yii\base\ErrorException


Call to a member function checkAccess() on a non-object



This error message points to vendor\yiisoft\yii2\web\User.php and the line number is 662. I don’t have any authmanager installed in my application.

Can anybody please explain where I went wrong with it and help me fix this issue?