mozilla / addons

☂ Umbrella repository for Mozilla Addons ✨
Other
127 stars 41 forks source link

No platform exists for user agent OS "<undefined agentOsName>" #12414

Closed willdurand closed 6 years ago

willdurand commented 6 years ago

Describe the problem and steps to reproduce it:

I read the production logs.

What happened?

I saw:

{
    "Fields": {
        "msg": "No platform exists for user agent OS \"<undefined agentOsName>\""
    },
    "Logger": "amo",
    "Severity": 3,
}

What did you expect to happen?

I don't know. Maybe it is a false positive but we should investigate why the user agent OS value is <undefined agentOsName>.

What to do?

We should change the log level of this message from error to warning by updating this block: https://github.com/mozilla/addons-frontend/blob/adb2ad0132798af9f5fee9e5c98c542265ba5b40/src/amo/components/PermissionsCard/permissions.js#L73-L77

Instead of calling log.error, we should call log.warn

kumar303 commented 6 years ago

An undefined user agent name is a likely scenario, especially for scripted requests. The current error logging is trying to alert us to unmapped agents (which would be a bug):

https://github.com/mozilla/addons-frontend/blob/adb2ad0132798af9f5fee9e5c98c542265ba5b40/src/amo/components/PermissionsCard/permissions.js#L73-L77

However, it should probably only log a warning. There are too many scenarios where a user could trigger this error and spam Sentry.

willdurand commented 6 years ago

However, it should probably only log a warning. There are too many scenarios where a user could trigger this error and spam Sentry.

Agreed!

seanprashad commented 6 years ago

Hey guys - I'd like to take this one up if that's ok!

@willdurand You mentioned that the error was found in production logs (which I assume regular contributors wouldn't have access to). Is there a way that we can reproduce this locally?

willdurand commented 6 years ago

@SeanPrashad you can try to use a tool like HTTPie to send request without a user agent.

seanprashad commented 6 years ago

I was taking a look at what master had since I couldn't find the log.error section and it looks like it's been updated:

screen shot 2018-10-19 at 6 02 58 pm

Using HTTPie allows me to specify a null user agent, but I'm not seeing the error message when I hit the localhost:3000/en-us/firefox/ endpoint with 2c5cfa470 checked out.

Should I look to reproduce this in a different manner?

Edit: Running http --verbose 127.0.0.1:3000/en-US/firefox/ 'User-Agent;' produces:

screen shot 2018-10-19 at 6 27 44 pm
willdurand commented 6 years ago

Ok, so I guess this is a wontfix since we don't have the log entry anymore.