Internal Server Error: /admin/analytics/token/
sg27950 opened this issue · comments
I've been struggling with this error. not sure what's it about ... please help thank you! @kyale-mwendwa @tomdyson
File "/Users/saranwai/Desktop/CAZA/CAZA_SITE/venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/Users/saranwai/Desktop/CAZA/CAZA_SITE/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/Users/saranwai/Desktop/CAZA/CAZA_SITE/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/Users/saranwai/Desktop/CAZA/CAZA_SITE/venv/lib/python3.7/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "/Users/saranwai/Desktop/CAZA/CAZA_SITE/venv/lib/python3.7/site-packages/wagtail/admin/urls/__init__.py", line 102, in wrapper
return view_func(request, *args, **kwargs)
File "/Users/saranwai/Desktop/CAZA/CAZA_SITE/venv/lib/python3.7/site-packages/wagtail/admin/decorators.py", line 34, in decorated_view
return view_func(request, *args, **kwargs)
File "/Users/saranwai/Desktop/CAZA/CAZA_SITE/venv/lib/python3.7/site-packages/django/utils/decorators.py", line 142, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/Users/saranwai/Desktop/CAZA/CAZA_SITE/caza/wagalytics/views.py", line 46, in token
access_token = get_access_token_from_str(settings.GA_KEY_CONTENT)
File "/Users/saranwai/Desktop/CAZA/CAZA_SITE/caza/wagalytics/views.py", line 36, in get_access_token_from_str
keyDict = json.loads(ga_key_content.replace('\n', '').replace('\r', ''))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[22/May/2019 09:29:28] "GET /admin/analytics/token/ HTTP/1.1" 500 16651 ```
Hi @sg27950
I was recently getting a 500 response from /admin/analytics/token/
as well. Mine was an Invalid JWT, though. Definitely make sure you have the right packages installed in your virtual environment. The readme mentions this:
pip install PyOpenSSL
and/orpip install pycrypto
Also make sure your analytics.json file is structured properly.
And lastly, the one that fixed my problem was to go into your Google Cloud Service Accounts and generate a brand new Key (just the key key and .json file, don't delete and create a new service account).
Hopefully this helps you out a bit!
@sg27950, Is your internet connection is running in the proxy?