SocialPass / socialpass

Hosting the next generation of events
https://registry.socialpass.io
Other
1 stars 0 forks source link

Google Wallet on Event Update #651

Closed crypto-rizzo closed 1 year ago

crypto-rizzo commented 1 year ago

Not confirmed, but when updating unit tests, I noticed that if google API fails on an event update request, then unhandled 500 error. Will do more digging but here is initial stack trace


 Internal Server Error: /dashboard/events/update/ca06ecae-95a9-4981-ad99-48ec46b31aa0/137/
Traceback (most recent call last):
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/contrib/auth/mixins.py", line 135, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 143, in dispatch
    return handler(request, *args, **kwargs)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/views/generic/edit.py", line 208, in post
    return super().post(request, *args, **kwargs)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/views/generic/edit.py", line 152, in post
    if form.is_valid():
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/forms/forms.py", line 201, in is_valid
    return self.is_bound and not self.errors
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/forms/forms.py", line 196, in errors
    self.full_clean()
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/forms/forms.py", line 435, in full_clean
    self._post_clean()
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/forms/models.py", line 486, in _post_clean
    self.instance.full_clean(exclude=exclude, validate_unique=False)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/db/models/base.py", line 1477, in full_clean
    self.clean()
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/apps/root/models.py", line 552, in clean
    self.clean_handle_google_event_class()
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/apps/root/models.py", line 541, in clean_handle_google_event_class
    google_event_class_id = self.handle_google_event_class()
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/apps/root/models.py", line 372, in handle_google_event_class
    response = GoogleTicket.GoogleTicket.insert_update_event_class(
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/apps/root/ticketing/GoogleTicket.py", line 120, in insert_update_event_class
    response = http_client.post(url, json=payload)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/requests/sessions.py", line 635, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/google/auth/transport/requests.py", line 545, in request
    self.credentials.before_request(auth_request, method, url, request_headers)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/google/auth/credentials.py", line 135, in before_request
    self.refresh(request)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/google/oauth2/service_account.py", line 429, in refresh
    access_token, expiry, _ = _client.jwt_grant(
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/google/oauth2/_client.py", line 303, in jwt_grant
    response_data = _token_endpoint_request(
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/google/oauth2/_client.py", line 274, in _token_endpoint_request
    _handle_error_response(response_data, retryable_error)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/google/oauth2/_client.py", line 73, in _handle_error_response
    raise exceptions.RefreshError(
google.auth.exceptions.RefreshError: ('invalid_grant: Invalid JWT Signature.', {'error': 'invalid_grant', 'error_description': 'Invalid JWT Signature.'})
E
======================================================================
ERROR: test_event_update (apps.dashboard.tests.test_views.DashboardTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/apps/dashboard/tests/test_views.py", line 290, in test_event_update
    response = self.client.post(
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/test/client.py", line 948, in post
    response = super().post(
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/test/client.py", line 482, in post
    return self.generic(
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/test/client.py", line 609, in generic
    return self.request(**r)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/test/client.py", line 891, in request
    self.check_exception(response)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/test/client.py", line 738, in check_exception
    raise exc_value
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/core/handlers/exception.py", line 55, in inner
    response = get_response(request)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 79, in inner
    return func(*args, **kwds)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/contrib/auth/mixins.py", line 135, in dispatch
    return super().dispatch(request, *args, **kwargs)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/views/generic/base.py", line 143, in dispatch
    return handler(request, *args, **kwargs)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/views/generic/edit.py", line 208, in post
    return super().post(request, *args, **kwargs)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/views/generic/edit.py", line 152, in post
    if form.is_valid():
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/forms/forms.py", line 201, in is_valid
    return self.is_bound and not self.errors
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/forms/forms.py", line 196, in errors
    self.full_clean()
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/forms/forms.py", line 435, in full_clean
    self._post_clean()
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/forms/models.py", line 486, in _post_clean
    self.instance.full_clean(exclude=exclude, validate_unique=False)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/django/db/models/base.py", line 1477, in full_clean
    self.clean()
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/apps/root/models.py", line 552, in clean
    self.clean_handle_google_event_class()
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/apps/root/models.py", line 541, in clean_handle_google_event_class
    google_event_class_id = self.handle_google_event_class()
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/apps/root/models.py", line 372, in handle_google_event_class
    response = GoogleTicket.GoogleTicket.insert_update_event_class(
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/apps/root/ticketing/GoogleTicket.py", line 120, in insert_update_event_class
    response = http_client.post(url, json=payload)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/requests/sessions.py", line 635, in post
    return self.request("POST", url, data=data, json=json, **kwargs)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/google/auth/transport/requests.py", line 545, in request
    self.credentials.before_request(auth_request, method, url, request_headers)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/google/auth/credentials.py", line 135, in before_request
    self.refresh(request)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/google/oauth2/service_account.py", line 429, in refresh
    access_token, expiry, _ = _client.jwt_grant(
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/google/oauth2/_client.py", line 303, in jwt_grant
    response_data = _token_endpoint_request(
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/google/oauth2/_client.py", line 274, in _token_endpoint_request
    _handle_error_response(response_data, retryable_error)
  File "/Users/kvn/_/Code/SPTECH/socialpass/backend/venv/lib/python3.10/site-packages/google/oauth2/_client.py", line 73, in _handle_error_response
    raise exceptions.RefreshError(
google.auth.exceptions.RefreshError: ('invalid_grant: Invalid JWT Signature.', {'error': 'invalid_grant', 'error_description': 'Invalid JWT Signature.'})

----------------------------------------------------------------------
Ran 46 tests in 6.040s
crypto-rizzo commented 1 year ago

Google API is blocking request on event create / update

crypto-rizzo commented 1 year ago

closing for now per discussions