TypeError exceptions in stripe processor
we're still getting a bunch of exceptions in prod, here's one example:
Oct 15 15:12:44 donate-01 donate[384326]: [ERROR: django.request.log_response] Internal Server Error: /stripe/process/
Oct 15 15:12:44 donate-01 donate[384326]: Traceback (most recent call last):
Oct 15 15:12:44 donate-01 donate[384326]: File "/home/tordonate/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
Oct 15 15:12:44 donate-01 donate[384326]: response = get_response(request)
Oct 15 15:12:44 donate-01 donate[384326]: ^^^^^^^^^^^^^^^^^^^^^
Oct 15 15:12:44 donate-01 donate[384326]: File "/home/tordonate/venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
Oct 15 15:12:44 donate-01 donate[384326]: response = wrapped_callback(request, *callback_args, **callback_kwargs)
Oct 15 15:12:44 donate-01 donate[384326]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 15 15:12:44 donate-01 donate[384326]: File "/home/tordonate/venv/lib/python3.11/site-packages/asgiref/sync.py", line 254, in __call__
Oct 15 15:12:44 donate-01 donate[384326]: return call_result.result()
Oct 15 15:12:44 donate-01 donate[384326]: ^^^^^^^^^^^^^^^^^^^^
Oct 15 15:12:44 donate-01 donate[384326]: File "/usr/lib/python3.11/concurrent/futures/_base.py", line 449, in result
Oct 15 15:12:44 donate-01 donate[384326]: return self.__get_result()
Oct 15 15:12:44 donate-01 donate[384326]: ^^^^^^^^^^^^^^^^^^^
Oct 15 15:12:44 donate-01 donate[384326]: File "/usr/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
Oct 15 15:12:44 donate-01 donate[384326]: raise self._exception
Oct 15 15:12:44 donate-01 donate[384326]: File "/home/tordonate/venv/lib/python3.11/site-packages/asgiref/sync.py", line 331, in main_wrap
Oct 15 15:12:44 donate-01 donate[384326]: result = await self.awaitable(*args, **kwargs)
Oct 15 15:12:44 donate-01 donate[384326]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 15 15:12:44 donate-01 donate[384326]: File "/home/tordonate/venv/lib/python3.11/site-packages/dependency_injector/wiring.py", line 994, in _patched
Oct 15 15:12:44 donate-01 donate[384326]: return await _async_inject(
Oct 15 15:12:44 donate-01 donate[384326]: ^^^^^^^^^^^^^^^^^^^^
Oct 15 15:12:44 donate-01 donate[384326]: File "src/dependency_injector/_cwiring.pyx", line 66, in _async_inject
Oct 15 15:12:44 donate-01 donate[384326]: File "/home/tordonate/app/tordonate/stripe/views.py", line 39, in process
Oct 15 15:12:44 donate-01 donate[384326]: if not AltchaView().test_challenge(data["payload"]): # type: ignore
Oct 15 15:12:44 donate-01 donate[384326]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 15 15:12:44 donate-01 donate[384326]: File "/home/tordonate/app/tordonate/views.py", line 195, in test_challenge
Oct 15 15:12:44 donate-01 donate[384326]: data = json.loads(base64.b64decode(payload))
Oct 15 15:12:44 donate-01 donate[384326]: ^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 15 15:12:44 donate-01 donate[384326]: File "/usr/lib/python3.11/base64.py", line 83, in b64decode
Oct 15 15:12:44 donate-01 donate[384326]: s = _bytes_from_decode_data(s)
Oct 15 15:12:44 donate-01 donate[384326]: ^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 15 15:12:44 donate-01 donate[384326]: File "/usr/lib/python3.11/base64.py", line 45, in _bytes_from_decode_data
Oct 15 15:12:44 donate-01 donate[384326]: raise TypeError("argument should be a bytes-like object or ASCII "
Oct 15 15:12:44 donate-01 donate[384326]: TypeError: argument should be a bytes-like object or ASCII string, not 'NoneType'
there's also this similar error:
Oct 16 00:46:52 donate-01 donate[384326]: [ERROR: django.request.log_response] Internal Server Error: /verifychallenge/
Oct 16 00:46:52 donate-01 donate[384326]: Traceback (most recent call last):
Oct 16 00:46:52 donate-01 donate[384326]: File "/home/tordonate/venv/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
Oct 16 00:46:52 donate-01 donate[384326]: response = get_response(request)
Oct 16 00:46:52 donate-01 donate[384326]: ^^^^^^^^^^^^^^^^^^^^^
Oct 16 00:46:52 donate-01 donate[384326]: File "/home/tordonate/venv/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
Oct 16 00:46:52 donate-01 donate[384326]: response = wrapped_callback(request, *callback_args, **callback_kwargs)
Oct 16 00:46:52 donate-01 donate[384326]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 16 00:46:52 donate-01 donate[384326]: File "/home/tordonate/venv/lib/python3.11/site-packages/django/views/decorators/csrf.py", line 56, in wrapper_view
Oct 16 00:46:52 donate-01 donate[384326]: return view_func(*args, **kwargs)
Oct 16 00:46:52 donate-01 donate[384326]: ^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 16 00:46:52 donate-01 donate[384326]: File "/home/tordonate/app/tordonate/views.py", line 261, in verify_challenge
Oct 16 00:46:52 donate-01 donate[384326]: body = json.loads(request.body)
Oct 16 00:46:52 donate-01 donate[384326]: ^^^^^^^^^^^^^^^^^^^^^^^^
Oct 16 00:46:52 donate-01 donate[384326]: File "/usr/lib/python3.11/json/__init__.py", line 346, in loads
Oct 16 00:46:52 donate-01 donate[384326]: return _default_decoder.decode(s)
Oct 16 00:46:52 donate-01 donate[384326]: ^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 16 00:46:52 donate-01 donate[384326]: File "/usr/lib/python3.11/json/decoder.py", line 337, in decode
Oct 16 00:46:52 donate-01 donate[384326]: obj, end = self.raw_decode(s, idx=_w(s, 0).end())
Oct 16 00:46:52 donate-01 donate[384326]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Oct 16 00:46:52 donate-01 donate[384326]: File "/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode
Oct 16 00:46:52 donate-01 donate[384326]: raise JSONDecodeError("Expecting value", s, err.value) from None
Oct 16 00:46:52 donate-01 donate[384326]: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
we should figure out what we do with those exceptions. right now we have alerts when exceptions come up, and it seems worthwhile to fix those, but if we're not going to fix them, i'm probably just going to remove those alerts.
for now i'll make a silence to hide them from our dashboards at least, because this is a bit noisy.