tracker: Column not found: 1054 Unknown column 'user_agent' in 'field list' ...
I got this error:
Illuminate\Database\QueryException SQLSTATE[42S22]: Column not found: 1054 Unknown column 'user_agent' in 'field list' (SQL: update tracker_sessionssetuser_agent= Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0,updated_at= 2017-09-23 06:40:46 whereid= 301550)
But even on a fresh install I don’t have this column in the tracker_sessions table! Is there a migration missing or something like that?
thanks
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 7
- Comments: 26 (3 by maintainers)
Commits related to this issue
- it fixes user agent problem with tracker https://github.com/antonioribeiro/tracker/issues/325#issuecomment-340290509 — committed to simonepozzobon/The-Film-Corner by simonepozzobon 7 years ago
- resolve issue #325 #388 — committed to ben-nsng/tracker by ben-nsng 6 years ago
- Fix issue #325 (https://github.com/antonioribeiro/tracker/issues/325). — committed to doncadavona/tracker by doncadavona 5 years ago
- Faster fix for Issue #325 on original source. — committed to doncadavona/tracker by doncadavona 5 years ago
- Merge pull request #391 from ben-nsng/master resolve issue #325 #388 — committed to antonioribeiro/tracker by antonioribeiro 5 years ago
- resolve issue #325 #388 — committed to deivide/tracker by ben-nsng 6 years ago
same issue here. Followed instructions as per readme.
edit:
I created this migration to deal with this issue
Hello,
I resolved temporarily:
In the
ensureSessionDataIsComplete()function of the file “pragmarx/tracker/src/Data/Repositories/Session.php” +or- in line 135, I added this:if($key === 'user_agent') continue;I also have same problem. 😄
I FIXED this by overriding the class that has the issue with
composer:First, copy the original class from the vendor to your app: $
cp vendor/pragmarx/tracker/src/Data/Repositories/Session.php app/VendorOverrides/PragmaRX/Tracker/Data/Repositories/Session.phpSecond, add the following inside the
autoloadobject incomposer.json:"files": ["app/VendorOverrides/PragmaRX/Tracker/Data/Repositories/Session.php"]Your
composer.json’sautoloadshould be like so:Third, add the following line after
line 134ofapp/VendorOverrides/PragmaRX/Tracker/Data/Repositories/Session.php:if ($key === 'user_agent') continue;The
ensureSessionDataIsComplete()function in ourSession.phpshould now be:Finally, run $
composer dump-autoload.Pull-requests for this like #391 or #448 are not yet merged. Until that, this should fix this issue.
I observed the same behavior in one of my apps while changing from desktop to mobile view in chromium and then reloading the page. The point is that the key ‘user_agent’ is built in vendor/pragmarx/tracker/src/Tracker.php in makeSessionData() and then later in vendor/pragmarx/tracker/src/Data/Repositories/Session.php in ensureSessionDataIsComplete() it wants to be stored back as an attribute of tracker_session.
The simplest workaround might be maikos code trick from September 2017 by just ignoring this field in the update loop. But there should also exist a cleaner way. Maybe @antonioribeiro has an idea?
Got this error as well. Wondering if adding the column would be the right solution as there is already an
agent_idin the table. Shouldn’t it be stored in the tracker_agents instead?+1 I also have the same problem…