elastic-coders / pushpull

Websocket to rabbitmq gateway
MIT License
3 stars 3 forks source link

`pushpull-client challenge_websocket` fails with an unclear error message #8

Closed vporton closed 6 years ago

vporton commented 6 years ago

I've installed pushpull-server. Then I run it:

$ pushpull-server
DEBUG:asyncio:Using selector: EpollSelector
======== Running on http://localhost:8080/ ========
(Press CTRL+C to quit)

In another terminal:

$ pushpull-client challenge_websocket http://localhost:8080/ user_token
DEBUG:asyncio:Using selector: EpollSelector
Traceback (most recent call last):
  File "/home/opus-test/test/bin/pushpull-client", line 11, in <module>
    sys.exit(client())
  File "/home/opus-test/test/lib/python3.5/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/home/opus-test/test/lib/python3.5/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/home/opus-test/test/lib/python3.5/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/opus-test/test/lib/python3.5/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/opus-test/test/lib/python3.5/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/opus-test/test/lib/python3.5/site-packages/pushpull/cli/client.py", line 22, in challenge_websocket
    click.echo(loop.run_until_complete(websocket_client.challenge(url, token, sys.stdin, sys.stdout, loop)))
  File "/usr/lib/python3.5/asyncio/base_events.py", line 466, in run_until_complete
    return future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
    raise self._exception
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/home/opus-test/test/lib/python3.5/site-packages/pushpull/websocket/client.py", line 22, in challenge
    async with session.ws_connect(url, headers={'Origin': 'localhost'}) as ws:
  File "/home/opus-test/test/lib/python3.5/site-packages/aiohttp/client.py", line 537, in __aenter__
    self._resp = yield from self._coro
  File "/home/opus-test/test/lib/python3.5/site-packages/aiohttp/client.py", line 307, in _ws_connect
    headers=resp.headers)
aiohttp.errors.WSServerHandshakeError: 404, message='Invalid response status'

It is a bug that this error message is not clear to know why it does not work.

vporton commented 6 years ago

Solved by changing to challenge_websocket http://localhost:8080/pushpull.

Please update your docs (README.rst) with this URL.

mpaolini commented 6 years ago

Thanks @vporton ! Fixed in https://github.com/elastic-coders/pushpull/commit/2ee4518b4ed918c2674edf16bb579348e6eb66e6