Wirecloud / docker-wirecloud

🐳 Docker Official Image packaging for WireCloud https://conwet.fi.upm.es/wirecloud
Other
8 stars 15 forks source link

HTTPError at /complete/fiware/ #24

Open francucchi opened 5 years ago

francucchi commented 5 years ago

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

  1. response = get_response(request)

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _legacy_get_response

  1. response = self._get_response(request)

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response

  1. response = self.process_exception_by_middleware(e, request)

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response

  1. 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

  1. response = view_func(request, *args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/django/views/decorators/csrf.py" in wrapped_view

  1. return view_func(*args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_django/utils.py" in wrapper

  1. return func(request, backend, *args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_django/views.py" in complete

  1. *args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_core/actions.py" in do_complete

  1. user = backend.complete(user=user, *args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_core/backends/base.py" in complete

  1. return self.auth_complete(*args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_core/utils.py" in wrapper

  1. return func(*args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_core/backends/oauth.py" in auth_complete

  1. method=self.ACCESS_TOKEN_METHOD

File "/usr/local/lib/python3.6/site-packages/social_core/backends/oauth.py" in request_access_token

  1. return self.get_json(*args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_core/backends/base.py" in get_json

  1. return self.request(url, *args, **kwargs).json()

File "/usr/local/lib/python3.6/site-packages/social_core/backends/base.py" in request

  1. response.raise_for_status()

File "/usr/local/lib/python3.6/site-packages/requests/models.py" in raise_for_status

  1. 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 commented 5 years ago

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 commented 5 years ago

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

  1. response = get_response(request)

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _legacy_get_response

  1. response = self._get_response(request)

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response

  1. response = self.process_exception_by_middleware(e, request)

File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response

  1. 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

  1. response = view_func(request, *args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/django/views/decorators/csrf.py" in wrapped_view

  1. return view_func(*args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_django/utils.py" in wrapper

  1. return func(request, backend, *args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_django/views.py" in complete

  1. *args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_core/actions.py" in do_complete

  1. user = backend.complete(user=user, *args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_core/backends/base.py" in complete

  1. return self.auth_complete(*args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_core/utils.py" in wrapper

  1. return func(*args, **kwargs)

File "/usr/local/lib/python3.6/site-packages/social_core/backends/oauth.py" in auth_complete

  1. state = self.validate_state()

File "/usr/local/lib/python3.6/site-packages/social_core/backends/oauth.py" in validate_state

  1. 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