-
-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logger causes Sentry issue #37
Comments
logger.error(
"ReCAPTCHA validation failed due to value of action '%s'"
" is not equal with defined '%s'.",
action,
self.recaptcha_action,
) perhaps it should be warning or even info level. |
Yeah, that should work. There's a couple of logger.error calls in that module - I'm getting caught on one of the others but I guess they should all be info level. |
let's see http errors/request fails, I think it's an error logger.error(
"ReCAPTCHA validation failed due to: %s",
check_captcha.error_codes,
)
raise ValidationError(self.messages["captcha_invalid"], code="captcha_invalid") it's probably the wrong key, nothing will work expected, imho it's an error logger.error(
"The response contains score, reCAPTCHA v2 response doesn't"
" contains score, probably secret key for reCAPTCHA v3",
)
raise ValidationError(self.messages["captcha_error"], code="captcha_error") it's probably the wrong key, nothing will work expected, imho it's an error logger.error(
"The response not contains score, reCAPTCHA v3 response must"
" contains score, probably secret key for reCAPTCHA v2",
)
raise ValidationError(self.messages["captcha_error"], code="captcha_error") it's INFO, sure it's not an error, this is legitimate logic logger.error(
"ReCAPTCHA validation failed due to score of %s"
" being lower than the required amount for action '%s'.",
self.score,
action,
) data sent for validation for another action, configuration problem/hackers/client bug/something similar like that logger.error(
"ReCAPTCHA validation failed due to value of action '%s'"
" is not equal with defined '%s'.",
action,
self.recaptcha_action,
) |
That first one is the one I'm getting a lot of and it's not the wrong key. It's "browser error" which is some sort of network failure, I think. So not a lot I can do about it and the user can just try again and hope. Either way, I don't want it to cause an issue that I have to try and fix because I can't fix it. |
"ReCAPTCHA validation failed due to: %s", -- this one? what is in the details? |
ReCAPTCHA validation failed due to: ["browser-error"] |
Ugh, I didn't realise that the newer versions of your library require newer versions of Django and we're on a pretty old version so I can't use this fix, unfortunately. |
I will create a release with this change from previous version tomorrow |
Yeah, we're way behind - long story - we're on Django 2.2.9! |
Sorry, but support of 2.2 was removed 2 years ago d71a378 the time to ask bosses to make time to upgrade a stack :) |
There are 5 options:
LOGGING = {
...
'loggers': {
'drf_recaptcha: {
'handlers': ['console'],
'level': 'INFO',
},
},
}
|
The use of logger.error in validators causes an issue to be created in my Sentry integration whenever a recaptcha field fails for whatever reason.
I don't really care about these failures, as it's probably nothing to do with me - it's probably a valid reason for failure (score too low or whatever) - so I don't really want a new issue to be generated every time it happens. But I can't switch off the logger.
The text was updated successfully, but these errors were encountered: