rosskouk / asknavidrome

An Alexa skill to allow streaming of music from Subsonic API compatible media servers on Amazon Echo devices.
https://rosskouk.github.io/asknavidrome
MIT License
48 stars 7 forks source link

[ISSUE] 400 Bad Request from Alexa Skill Test #24

Closed heyitsforest closed 1 year ago

heyitsforest commented 1 year ago

Describe the issue Followed the documentation, but using the Alexa test I'm getting 400 Bad Request in the logs and Alexa says "There was a problem with the requested skill's response". I think it might be down to my reverse proxy. I'm using Swag (Nginx) and Docker. Certs have been generated. I added a .conf for the app but it might be incorrect. Is there a suggested .conf? The site returns 502 Bad Gateway when accessed in the browser.

Logs navisonic | 2023-05-29 21:14:03,476 - werkzeug - ERROR - 172.19.0.20 - - [29/May/2023 21:14:03] code 400, message Bad request version ("k>±©É¶\x0fÎæ\x00\x008À,À0\x00\x9f̨̩̪À+À/\x00\x9eÀ$À(\x00kÀ#À'\x00gÀ") navisonic | 2023-05-29 21:14:03,476 - werkzeug - INFO - 172.19.0.20 - - [29/May/2023 21:14:03] " · ³s*¹zÙo†×fb Ó+§±À)Ð} k>±©É¶Îæ 8À,À0 ŸÌ©Ì¨ÌªÀ+À/ žÀ$À( kÀ#À' gÀ" HTTPStatus.BAD_REQUEST -

I'd really appreciate any help to get this setup, thanks!

rosskouk commented 1 year ago

Hi,

Can you provide a sanitised copy of your config file please?

heyitsforest commented 1 year ago

Thanks! Here's the current nginx conf:

server {
listen 443 ssl;
listen [::]:443 ssl;
server_name echo.example.com;
include /config/nginx/ssl.conf;
location / {
set $upstream_app navisonic;
set $upstream_port 5000;
set $upstream_proto https;
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
}
}  
heyitsforest commented 1 year ago

Hi,

Can you provide a sanitised copy of your config file please?

Any chance you could add a default config file? I've looked through the docs again but can't see much about the reverse proxy part. The certs are no problem and my other services are running fine. I'd love to get this up and running.

Or is there somewhere else the issue might be?

Thanks again.

rosskouk commented 1 year ago

Hi,

I'll try and write something up over the next few days. There isn't a default config as there are several methods of doing this, along with the different ways you can have your Navidrome instance configured.

From the actual error logs you pasted, the actual message looks like garbage characters. If I had to make a guess I'd say that Navidrome is running with Https enabled and the reverse proxy is accessing that with Http.

I'm not familiar with Nginx, but I'll have a look as soon as I can, let me know if you make any progress in the meantime.

heyitsforest commented 1 year ago

What method do you suggest for the reverse proxy part? Or what's your current setup? I'd be happy to try it out on another server just to get started. The docs mention a few options but don't give a working example for any of them.

rosskouk commented 1 year ago

I personally use Ingress Nginx in a Kubernetes cluster.

Can you send over a sanitised copy of your skill config too please?

DpunktKpunkt commented 1 year ago

Simply change your variable $upstream_proto to http, as asknavidrome is listening at port 5000 via plain http.

heyitsforest commented 1 year ago

Thanks, that got the reverse proxy to forward requests to the navisonic container.

I was still having issues, but I found the cause - I only allow access from IPs on an allowlist and "deny all" for others. I thought it might send requests locally but of course it goes via alexa's servers.

It works when I allow all IPs, so I'll have to set up some access rules for alexa to access the server.

Thanks a lot for your help!