Skip to content
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

HTTPError at /complete/fiware/ #24

Open
francucchi opened this issue Feb 19, 2019 · 2 comments
Open

HTTPError at /complete/fiware/ #24

francucchi opened this issue Feb 19, 2019 · 2 comments

Comments

@francucchi
Copy link

Hello,
I'm running dockerized images of wirecloud+nginx and keyrock (with OAuth2) and I'm having some issues probably related to gunicorn running in the wirecloud image.
Here's below the stack trace:

Environment:

Request Method: GET
Request URL: http://192.168.5.205/complete/fiware/?code=787979c8344a72a03386f1a4863e8c1a82f2851f&state=AIx9Oo103l7biQT8XOzCqNg0A0XkUrH0

Django Version: 1.11.18
Python Version: 3.6.8
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'wirecloud.commons',
'compressor',
'wirecloud.catalogue',
'wirecloud.platform',
'wirecloud.fiware',
'social_django',
'haystack',
'wirecloud_pubsub')
Installed Middleware:
('wirecloud.commons.middleware.URLMiddleware',)

Traceback:

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
41. response = get_response(request)

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _legacy_get_response
249. response = self._get_response(request)

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/usr/local/lib/python3.6/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
57. response = view_func(request, *args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/django/views/decorators/csrf.py" in wrapped_view
58. return view_func(*args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_django/utils.py" in wrapper
49. return func(request, backend, *args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_django/views.py" in complete
33. *args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_core/actions.py" in do_complete
43. user = backend.complete(user=user, *args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_core/backends/base.py" in complete
40. return self.auth_complete(*args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_core/utils.py" in wrapper
259. return func(*args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_core/backends/oauth.py" in auth_complete
401. method=self.ACCESS_TOKEN_METHOD

File "/usr/local/lib/python3.6/site-packages/social_core/backends/oauth.py" in request_access_token
373. return self.get_json(*args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_core/backends/base.py" in get_json
238. return self.request(url, *args, **kwargs).json()

File "/usr/local/lib/python3.6/site-packages/social_core/backends/base.py" in request
234. response.raise_for_status()

File "/usr/local/lib/python3.6/site-packages/requests/models.py" in raise_for_status
940. raise HTTPError(http_error_msg, response=self)

Exception Type: HTTPError at /complete/fiware/
Exception Value: 500 Server Error: Internal Server Error for url: http://192.168.5.205:3005/oauth2/token

I have all the cookies:

Variable Value
_csrf 'WVJw39Q6x_KHtv9xCdAlhJTe'
csrftoken 'c2ehey0WSYQQBGhsrDw2Cb84rjMEvYsiKgyewMfLH7oYGKfGF8HQGnVWeJWolNtx'
connect.sid 's%3A0voE9jUAO_AT8Wy3cj8hTpkMtj3qpn0K.9NqHXYtRyl%2FXC72KW91hS2M254%2FLuxNipGU7fwn8xC0'
sessionid 'vovvszqd3abrq0x07rqv42uahp6wp3df'
io 'CXqIpDUX8MD5KBOMAAAB'
wcsessionid 'to0chnkz1qgubv2uga7csiz230jbqu6j'
session 'eyJyZWRpciI6Ii8iLCJ1c2VyIjp7ImlkIjoiYWFhYWFhYWEtZ29vZC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAwIiwidXNlcm5hbWUiOiJhbGljZSIsImVtYWlsIjoiYWxpY2UtdGhlLWFkbWluQHRlc3QuY29tIiwiaW1hZ2UiOiIvaW1nL2xvZ29zL3NtYWxsL3VzZXIucG5nIn19'
session.sig '0tKZ56-hzAlYR4mHNIHO7jLqzwE'

The only clear error appearing in the info is below:

SERVER_SOFTWARE 'gunicorn/19.3.0'
gunicorn.socket <socket.socket fd=10, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('172.18.1.11', 8000), raddr=('172.18.1.15', 38980)>
wsgi.errors <gunicorn.http.wsgi.WSGIErrorsWrapper object at 0x7f02b2922e10>
wsgi.file_wrapper ''
wsgi.input <gunicorn.http.body.Body object at 0x7f02b2922a58>
wsgi.multiprocess True
wsgi.multithread False
wsgi.run_once False
wsgi.url_scheme 'http'
wsgi.version (1, 0)

where 172.18.1.11 is internal IP address of wirecloud and 172.18.1.15 is internal IP address of nginx.

Any idea?

Thanks

@aarranz
Copy link
Member

aarranz commented Feb 20, 2019

Hi @francucchi!

It seems a problem on the KeyRock configuration/deployment. The stack trace is telling you that WireCloud received a 500 error (an internal server error) response from KeyRock when making the request to http://192.168.5.205:3005/oauth2/token.

Please, check the logs of keyrock for more details.

@francucchi
Copy link
Author

Hi @aarranz !
thanks for your reply.
Sorry for the delay in getting back to you but it took me some time to replace the keyrock docker image with a more updated revision available on github which has now solved the 500 Internal Server Error.
Unfortunately a new error is appearing after the authentication through keyrock:

Environment:

Request Method: GET
Request URL: http://192.168.5.205/complete/fiware/?code=cd89222715de84ab3495025a1d49127015f87568&state=PymRXOcThJfteE3Gbvowc1BM2BJFuG6b

Django Version: 1.11.18
Python Version: 3.6.8
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'wirecloud.commons',
'compressor',
'wirecloud.catalogue',
'wirecloud.platform',
'wirecloud.fiware',
'social_django',
'haystack',
'wirecloud_pubsub')
Installed Middleware:
('wirecloud.commons.middleware.URLMiddleware',)

Traceback:

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
41. response = get_response(request)

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _legacy_get_response
249. response = self._get_response(request)

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/usr/local/lib/python3.6/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
57. response = view_func(request, *args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/django/views/decorators/csrf.py" in wrapped_view
58. return view_func(*args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_django/utils.py" in wrapper
49. return func(request, backend, *args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_django/views.py" in complete
33. *args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_core/actions.py" in do_complete
43. user = backend.complete(user=user, *args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_core/backends/base.py" in complete
40. return self.auth_complete(*args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_core/utils.py" in wrapper
259. return func(*args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_core/backends/oauth.py" in auth_complete
388. state = self.validate_state()

File "/usr/local/lib/python3.6/site-packages/social_core/backends/oauth.py" in validate_state
90. raise AuthStateMissing(self, 'state')

Exception Type: AuthStateMissing at /complete/fiware/
Exception Value: Session value state missing.

I have already implemented the workaround for:

SESSION_COOKIE_NAME = "wcsessionid"
CSRF_COOKIE_NAME = "wccsrftoken"

but problem still appears.

Any idea?

Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants