andreaselia / laravel-analytics

Analytics for the Laravel framework.
MIT License
165 stars 25 forks source link

Error Detection\MobileDetect::setUserAgent() after updating to Laravel 11 #64

Closed buzkall closed 3 months ago

buzkall commented 3 months ago

My log shows this error:

TypeError · Detection\MobileDetect::setUserAgent(): Argument #1 ($userAgent) must be of type string, null given, called in vendor/andreaselia/analytics/src/Http/Middleware/Analytics.php on line 33

The request headers look like this:

{
  "cf-connecting-ip": "198.235.24.149",
  "cf-visitor": "{\"scheme\":\"https\"}",
  "x-forwarded-proto": "https",
  "cf-ray": "88dc5697cb9704aa-CDG",
  "x-forwarded-for": "198.235.24.149",
  "accept-encoding": "gzip, br",
  "cf-ipcountry": "US",
  "cdn-loop": "cloudflare",
}
andreaselia commented 3 months ago

@buzkall what version of the package are you on?

andreaselia commented 3 months ago

We have a version 2 out if you're not already on it.

buzkall commented 3 months ago

Yes, I'm using version 2

andreaselia commented 3 months ago

@tomirons any other questions in mind to help debug this?

Line 33 in the package for that file is a blank line.

tomirons commented 3 months ago

Which specific version are you using? This might help figure this out.

andreaselia commented 3 months ago

There's only one version 2 I think, but might be worth verifying what's in your composer.json file @buzkall.

andreaselia commented 3 months ago

@buzkall can you try v2.1.0 and let us know how you get on please? Thank you!