self-hosted login redirect issue after updating to 3.6

I just finished getting everything to work after upgrading to 3.6. Now, when I login, at mydomain.com/login, it logs me in but then redirects right back to mydomain.com/login with the message: Whoops, looks like something went wrong.

I know it logs me in because if I type directly mydomain.com/dashboard, it brings up my dashboard.

Any suggestions?

Can you check for details about the error in storage/logs/laravel-error.log

Here are the contents of my laravel-error.log:

[2017-08-10 20:44:50] production.ERROR: ErrorException [0] : /home4/dubclickdev/pm.doubleclickdevelopment.com/app/Libraries/HistoryUtils.php [Line 74] => Argument 1 passed to App\Libraries\HistoryUtils::trackViewed() must be an instance of App\Models\EntityModel, null given, called in /home4/dubclickdev/pm.doubleclickdevelopment.com/app/Libraries/HistoryUtils.php on line 70 and defined {“context”:“PHP”,“user_id”:1,“account_id”:“1”,“user_name”:“Tim Chadwick”,“method”:“POST”,“url”:“http://pm.doubleclickdevelopment.com/login",“previous”:“http://pm.doubleclickdevelopment.com/login?clear_cache=true”,“user_agent”:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36”,“ip”:“73.52.178.41”,“count”:1,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”} []
[2017-08-10 20:48:14] production.ERROR: ErrorException [0] : /home4/dubclickdev/pm.doubleclickdevelopment.com/app/Libraries/HistoryUtils.php [Line 74] => Argument 1 passed to App\Libraries\HistoryUtils::trackViewed() must be an instance of App\Models\EntityModel, null given, called in /home4/dubclickdev/pm.doubleclickdevelopment.com/app/Libraries/HistoryUtils.php on line 70 and defined {“context”:“PHP”,“user_id”:1,“account_id”:“1”,“user_name”:“Tim Chadwick”,“method”:“POST”,“url”:“http://pm.doubleclickdevelopment.com/login",“previous”:“http://pm.doubleclickdevelopment.com/login”,“user_agent”:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36”,“ip”:“73.52.178.41”,“count”:1,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”} []
[2017-08-10 20:50:05] production.ERROR: ErrorException [0] : /home4/dubclickdev/pm.doubleclickdevelopment.com/app/Libraries/HistoryUtils.php [Line 74] => Argument 1 passed to App\Libraries\HistoryUtils::trackViewed() must be an instance of App\Models\EntityModel, null given, called in /home4/dubclickdev/pm.doubleclickdevelopment.com/app/Libraries/HistoryUtils.php on line 70 and defined {“context”:“PHP”,“user_id”:1,“account_id”:“1”,“user_name”:“Tim Chadwick”,“method”:“POST”,“url”:“http://pm.doubleclickdevelopment.com/login",“previous”:“http://pm.doubleclickdevelopment.com/login”,“user_agent”:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:54.0) Gecko/20100101 Firefox/54.0”,“ip”:“73.52.178.41”,“count”:1,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”} []
[2017-08-10 20:56:05] production.ERROR: ErrorException [0] : /home4/dubclickdev/pm.doubleclickdevelopment.com/app/Libraries/HistoryUtils.php [Line 74] => Argument 1 passed to App\Libraries\HistoryUtils::trackViewed() must be an instance of App\Models\EntityModel, null given, called in /home4/dubclickdev/pm.doubleclickdevelopment.com/app/Libraries/HistoryUtils.php on line 70 and defined {“context”:“PHP”,“user_id”:1,“account_id”:“1”,“user_name”:“Tim Chadwick”,“method”:“POST”,“url”:“http://pm.doubleclickdevelopment.com/login",“previous”:“http://pm.doubleclickdevelopment.com/login”,“user_agent”:"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36”,“ip”:“73.52.178.41”,“count”:2,“is_console”:“no”,“is_api”:“no”,“db_server”:“mysql”} []

Thanks!

Any chance data has been manually deleted from the database?

Not that I’m aware of.

From the error it looks like there are records in the activities table which don’t have matching entities.

The only cause we’ve seen for this problem is data being manually deleted.

You may be able to fix this by deleting the invalid activity rows or adding a check for the entity here.

https://github.com/invoiceninja/invoiceninja/blob/master/app/Libraries/HistoryUtils.php#L70

How do I tell which activity rows are the invalid ones?

You’d need to write a custom SQL query.