-
Notifications
You must be signed in to change notification settings - Fork 340
Closed
Labels
Description
[READ] Step 1: Are you in the right place?
- For issues or feature requests related to the code in this repository
file a Github issue.- If this is a feature request make sure the issue title starts with "FR:".
- For general technical questions, post a question on StackOverflow
with the firebase tag. - For general Firebase discussion, use the firebase-talk
google group. - For help troubleshooting your application that does not fall under one
of the above categories, reach out to the personalized
Firebase support channel.
[REQUIRED] Step 2: Describe your environment
- Operating System version: macos catalina 10.15.2
- Firebase SDK version: not sure how to find this
- Library version: 3.0.0
- Firebase Product: auth(auth, database, storage, etc)
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
What happened? How can we make the problem occur?
It seems firebase_admin_python's dependency on cachecontrol is causing this problem. Basically what I understand is as follows:
- firebase-admin-python is dependent on cachecontrol library.
- cachecontrol is dependent on
msgpack
which seems to have deprecated "encoding" parameter inmsgpack.loads()
method in its recent release (v1.0.0rc1) 10 days ago. - fix has been merged to cachecontrol, but there seem to be no releases since 2018.
- so if I pipenv-install firebase-admin-python, cachecontrol==0.12.5 is installed; a version without the fix.
- hence the error below. See the error log.
related links that might help you understand the problem
DeprecationWarning in use of msgpack #198
issue related to above
This could be a description, log/console output, etc.
# error.log
django_1 | File "/usr/local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 34, in inner
django_1 | response = get_response(request)
django_1 | File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py", line 115, in _get_response
django_1 | response = self.process_exception_by_middleware(e, request)
django_1 | File "/usr/local/lib/python3.8/site-packages/django/core/handlers/base.py", line 113, in _get_response
django_1 | response = wrapped_callback(request, *callback_args, **callback_kwargs)
django_1 | File "/usr/local/lib/python3.8/contextlib.py", line 75, in inner
django_1 | return func(*args, **kwds)
django_1 | File "/usr/local/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
django_1 | return view_func(*args, **kwargs)
django_1 | File "/usr/local/lib/python3.8/site-packages/rest_framework/viewsets.py", line 114, in view
django_1 | return self.dispatch(request, *args, **kwargs)
django_1 | File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 505, in dispatch
django_1 | response = self.handle_exception(exc)
django_1 | File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 465, in handle_exception
django_1 | self.raise_uncaught_exception(exc)
django_1 | File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception
django_1 | raise exc
django_1 | File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 493, in dispatch
django_1 | self.initial(request, *args, **kwargs)
django_1 | File "/usr/local/lib/python3.8/site-packages/sentry_sdk/integrations/django/__init__.py", line 275, in sentry_patched_drf_initial
django_1 | return old_drf_initial(self, request, *args, **kwargs)
django_1 | File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 410, in initial
django_1 | self.perform_authentication(request)
django_1 | File "/usr/local/lib/python3.8/site-packages/rest_framework/views.py", line 324, in perform_authentication
django_1 | request.user
django_1 | File "/usr/local/lib/python3.8/site-packages/rest_framework/request.py", line 220, in user
django_1 | self._authenticate()
django_1 | File "/usr/local/lib/python3.8/site-packages/rest_framework/request.py", line 373, in _authenticate
django_1 | user_auth_tuple = authenticator.authenticate(self)
django_1 | File "/usr/local/lib/python3.8/site-packages/drf_firebase/authentication.py", line 39, in authenticate
django_1 | return self.authenticate_credentials(firebase_token)
django_1 | File "/code/apps/firebase_auth/authentication.py", line 25, in authenticate_credentials
django_1 | decoded_token = firebase_auth.verify_id_token(
django_1 | File "/usr/local/lib/python3.8/site-packages/firebase_admin/auth.py", line 177, in verify_id_token
django_1 | verified_claims = token_verifier.verify_id_token(id_token)
django_1 | File "/usr/local/lib/python3.8/site-packages/firebase_admin/_token_gen.py", line 234, in verify_id_token
django_1 | return self.id_token_verifier.verify(id_token, self.request)
django_1 | File "/usr/local/lib/python3.8/site-packages/firebase_admin/_token_gen.py", line 328, in verify
django_1 | verified_claims = google.oauth2.id_token.verify_token(
django_1 | File "/usr/local/lib/python3.8/site-packages/google/oauth2/id_token.py", line 121, in verify_token
django_1 | certs = _fetch_certs(request, certs_url)
django_1 | File "/usr/local/lib/python3.8/site-packages/google/oauth2/id_token.py", line 95, in _fetch_certs
django_1 | response = request(certs_url, method="GET")
django_1 | File "/usr/local/lib/python3.8/site-packages/google/auth/transport/requests.py", line 168, in __call__
django_1 | response = self.session.request(
django_1 | File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 533, in request
django_1 | resp = self.send(prep, **send_kwargs)
django_1 | File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 646, in send
django_1 | r = adapter.send(request, **kwargs)
django_1 | File "/usr/local/lib/python3.8/site-packages/cachecontrol/adapter.py", line 44, in send
django_1 | cached_response = self.controller.cached_request(request)
django_1 | File "/usr/local/lib/python3.8/site-packages/cachecontrol/controller.py", line 145, in cached_request
django_1 | resp = self.serializer.loads(request, cache_data)
django_1 | File "/usr/local/lib/python3.8/site-packages/cachecontrol/serialize.py", line 97, in loads
django_1 | return getattr(self, "_loads_v{}".format(ver))(request, data)
django_1 | File "/usr/local/lib/python3.8/site-packages/cachecontrol/serialize.py", line 182, in _loads_v4
django_1 | cached = msgpack.loads(data, encoding="utf-8")
django_1 | File "msgpack/_unpacker.pyx", line 144, in msgpack._cmsgpack.unpackb
django_1 | TypeError: unpackb() got an unexpected keyword argument 'encoding'
I am running django/nginx in docker container with docker-compose. Funny this is if I send the request with firebase token in header directly to django container, this error does not show up. This error only arises if I send the request to nginx container which acts as proxy.
Any plans to fix this? in the meantime how should ideas for quick fix before next release?
Relevant Code:
// TODO(you): code here to reproduce the problem