Listen broken for S3 config
Steps to reproduce
I have a config with the following setup:
MEDIA_ROOT=/srv/funkwhale/data/media
STATIC_ROOT=/srv/funkwhale/data/static
DJANGO_SETTINGS_MODULE=config.settings.production
# This exists, but is empty.
MUSIC_DIRECTORY_PATH=/srv/funkwhale/data/music
MUSIC_DIRECTORY_SERVE_PATH=/srv/funkwhale/data/music
AWS_ACCESS_KEY_ID=(redacted)
AWS_SECRET_ACCESS_KEY=(redacted)
AWS_STORAGE_BUCKET_NAME=(redacted)
AWS_S3_REGION_NAME=(redacted)
AWS_QUERYSTRING_EXPIRE=3600
PROXY_MEDIA=false
I followed the (very easy, thank you) Linux install instructions, and am running 1.2.8. (Via the zip, not git.) I can see the site, sign in, and upload music. I have verified that the files definitely get written to the S3 bucket.
What happens?
However, any requests to /api/v1/listen/*/?upload=*&token=*
all fail with a 500.
When I use journalctl
to see the error, it looks like gunicorn:
NotImplementedError: This backend doesn't support absolute paths.
raise NotImplementedError("This backend doesn't support absolute paths.")
File "/srv/funkwhale/virtualenv/lib/python3.8/site-packages/django/core/files/storage.py", line 128, in path
return self.storage.path(self.name)
File "/srv/funkwhale/virtualenv/lib/python3.8/site-packages/django/db/models/fields/files.py", line 59, in path
path = audio_file.path
File "/srv/funkwhale/api/funkwhale_api/music/views.py", line 489, in get_file_path
file_path = get_file_path(f.audio_file)
File "/srv/funkwhale/api/funkwhale_api/music/views.py", line 562, in handle_serve
response = f(*args, **kwargs)
File "/srv/funkwhale/api/funkwhale_api/music/views.py", line 540, in inner
return handle_serve(
File "/srv/funkwhale/api/funkwhale_api/music/views.py", line 663, in handle_stream
return handle_stream(track, request, **config)
File "/srv/funkwhale/api/funkwhale_api/music/views.py", line 642, in retrieve
response = handler(request, *args, **kwargs)
I have also tried PROXY_MEDIA=true
, which yields the same stack trace.
(But it does seem to do the reverse of what I'd expect: it produces Internet-facing S3 URLs for album art without pre-signed URLs, and so requires me to make the bucket public. So I definitely am not interested in that.)
What is expected?
The listen
endpoint would not 500, and would instead returned a pre-signed URL for the track.
Context
Funkwhale version(s) affected: 1.2.8+git.fb10d1a3