spl0k / supysonic

Supysonic is a Python implementation of the Subsonic server API.

Home Page:https://supysonic.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot connect with mopidy.

mooskagh opened this issue · comments

When I tried to connect to the server from mopidy-subidy, supysonic seems to return HTTP status 400 to all requests:

2a02:(redacted ipv6 address):4303 - - [05/May/2020 18:53:23] "POST /rest/getArtists.view HTTP/1.1" 400 -
2a02:(redacted ipv6 address):4303 - - [05/May/2020 18:53:23] "POST /rest/getArtists.view HTTP/1.1" 400 -
...
2a02:(redacted ipv6 address):4303 - - [05/May/2020 18:58:10] "POST /rest/ping.view HTTP/1.1" 400 -

I tried to set this in my config

[webapp]
log_file = /tmp/supysonic.log
log_level = DEBUG

The log file is created, but it is completely empty.

I'm able to access the supysonic web UI with my browser.

Version of supysonic is from github master as of yesterday.

Same issue occurs whether I run it through uUWSGI or as a command line debug server.
Could you give me a hint how to debug this further? I can put debug prints into random parts of the code if that helps.

Thanks!

  File "/usr/lib/python3.8/threading.py", line 890, in _bootstrap
    self._bootstrap_inner()
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.8/socketserver.py", line 650, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.8/socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.8/socketserver.py", line 720, in __init__
    self.handle()
  File "/home/music/virtualenv/lib/python3.8/site-packages/werkzeug/serving.py", line 345, in handle
    BaseHTTPRequestHandler.handle(self)
  File "/usr/lib/python3.8/http/server.py", line 427, in handle
    self.handle_one_request()
  File "/home/music/virtualenv/lib/python3.8/site-packages/werkzeug/serving.py", line 379, in handle_one_request
    return self.run_wsgi()
  File "/home/music/virtualenv/lib/python3.8/site-packages/werkzeug/serving.py", line 323, in run_wsgi
    execute(self.server.app)
  File "/home/music/virtualenv/lib/python3.8/site-packages/werkzeug/serving.py", line 314, in execute
    for data in application_iter:
  File "/home/music/virtualenv/lib/python3.8/site-packages/werkzeug/debug/__init__.py", line 304, in debug_application
    app_iter = self.app(environ, start_response)
  File "/home/music/virtualenv/lib/python3.8/site-packages/flask/app.py", line 2464, in __call__
    return self.wsgi_app(environ, start_response)
  File "/home/music/virtualenv/lib/python3.8/site-packages/pony/utils/utils.py", line 37, in pony_wrapper
    return caller(func, *args, **kwargs)
  File "/home/music/virtualenv/lib/python3.8/site-packages/pony/orm/core.py", line 528, in new_func
    result = func(*args, **kwargs)
  File "/home/music/virtualenv/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/music/virtualenv/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/music/virtualenv/lib/python3.8/site-packages/flask/app.py", line 1822, in handle_user_exception
    return handler(e)
  File "/home/music/virtualenv/lib/python3.8/site-packages/supysonic/api/errors.py", line 28, in key_error
    return MissingParameter()
  File "/home/music/virtualenv/lib/python3.8/site-packages/supysonic/api/exceptions.py", line 53, in __init__

Seems that BadRequestKeyError happens, whatever it means.
That's just the POST /rest/ping.view HTTP/1.1 request.

  File "/home/music/virtualenv/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.preprocess_request()
  File "/home/music/virtualenv/lib/python3.8/site-packages/flask/app.py", line 2245, in preprocess_request
    rv = func()
  File "/home/music/virtualenv/lib/python3.8/site-packages/supysonic/api/__init__.py", line 62, in authorize
    password = request.values["p"]
  File "/home/music/virtualenv/lib/python3.8/site-packages/werkzeug/datastructures.py", line 1525, in __getitem__
    raise exceptions.BadRequestKeyError(key)

It expects p parameter for rest/ping.view request.

commented

Hello.

This is due to missing authentication. Supysonic doesn't support the token-based auth introduced with the version 1.13.0 of the Subsonic API. As such you'll have to set legacy_auth to true in you subidy configuration.

Thanks for your response, that indeed works!

I'm closing the issue as it's resolved for me. However I'd recommend to print an appropriate error message somewhere in logs/etc to save other people from trying to debug this.