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
52 stars 7 forks source link

[ISSUE] Could not connect with the skill #40

Open adocampo opened 5 months ago

adocampo commented 5 months ago

Describe the issue I followed the steps but when testing, it cannot connect to my skill. I know I'm doing something wrong, but I cannot determine what can be. I think documentation can me confusing, at least I found it confusing. In requirements, is stated:

But in the Troubleshooting section, it states

Is the endpoint set correctly? The endpoint is the URL to the web service.

Nowhere specifies how to configure the web service. I modified the docker-compose.yml to match my alexa skill ID, navidrome URL, user and password, like this

 version: '3.7'
 services:
     asknavidrome:
         environment:
             - 'NAVI_SKILL_ID=amzn1.ask.skill.xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
             - 'NAVI_URL=https://music.example.com'
             - 'NAVI_USER=alexaplayer'
             - 'NAVI_PASS=supersecretpassword'
             - 'NAVI_SONG_COUNT=50'
             - 'NAVI_PORT=443'
             - 'NAVI_API_PATH=/rest'
             - 'NAVI_API_VER=1.16.1'
             - 'NAVI_DEBUG=1'
         ports:
             - '5555:5000'    <-- I've used the port 5555 because I already using port 5000 for other stuff
         image: 'ghcr.io/rosskouk/asknavidrome:latest'
         logging:
             driver: "json-file"
             options:
                 max-size: "10m"
                 max-file: "1"
         deploy:
             restart_policy:
                 condition: on-failure
                 delay: 5s
                 max_attempts: 3
                 window: 120s

And I set up it as https://naviendpoint.example.com, and I see it's reachable from internet, showing this in a browser image

But no luck, when I test it, it says this

image

{
    "version": "1.0",
    "session": {
        "new": false,
        "sessionId": "amzn1.echo-api.session.7bdeb8c9-52cd-4acc-95f9-7556ab852f53",
        "application": {
            "applicationId": "amzn1.ask.skill.xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
        },
        "attributes": {},
        "user": {
            "userId": "amzn1.ask.account.AMA3LQYTH6AWXUQMNZUVKDVCKEB4PXANQVTNARP6Q23QBZWFTOAKRPPYT2TQ7EJMX7PSQTG43GQUORJFOSKLXIWOTEJR6YLTP7APOYPXS3MSVV2AFQJMQMNZUVKDVCKEB4PXANQVTNARP6Q2GIQQX2SFFLWUX4KLYAPWPHXXZM46TUXYSCWMR6BJP5HVGOXL6D5M5WHZUPEQ6PKLCYL2KQFQ"
        }
    },
    "context": {
        "Viewports": [
            {
                "type": "APL",
                "id": "main",
                "shape": "RECTANGLE",
                "dpi": 213,
                "presentationType": "STANDARD",
                "canRotate": false,
                "configuration": {
                    "current": {
                        "mode": "HUB",
                        "video": {
                            "codecs": [
                                "H_264_42",
                                "H_264_41"
                            ]
                        },
                        "size": {
                            "type": "DISCRETE",
                            "pixelWidth": 1280,
                            "pixelHeight": 800
                        }
                    }
                }
            }
        ],
        "AudioPlayer": {
            "playerActivity": "IDLE"
        },
        "Viewport": {
            "experiences": [
                {
                    "arcMinuteWidth": 346,
                    "arcMinuteHeight": 216,
                    "canRotate": false,
                    "canResize": false
                }
            ],
            "mode": "HUB",
            "shape": "RECTANGLE",
            "pixelWidth": 1280,
            "pixelHeight": 800,
            "dpi": 213,
            "currentPixelWidth": 1280,
            "currentPixelHeight": 800,
            "touch": [
                "SINGLE"
            ],
            "video": {
                "codecs": [
                    "H_264_42",
                    "H_264_41"
                ]
            }
        },
        "Extensions": {
            "available": {
                "aplext:backstack:10": {}
            }
        },
        "System": {
            "application": {
                "applicationId": "amzn1.ask.skill.e60b74bb-526f-4a06-a68e-88ddccf4bf36"
            },
            "user": {
                "userId": "amzn1.ask.account.AMA3LQYTH6AWXULKLNAV63QVH7IXKM2FEFU4EQ5PAAP3QBZWFTOAKRPPYT2TQ7EJMX7PSQTG43GQUORJFOSKLXIWOTEJR6YLTP7APOYPXSQMNZQMNZUVKDVCKEB4PXANQVTNARP6Q2MNGGIIOQIY3NSSSBDDGIQQX2SFFLWUX4KLYAPWPHXXZM46TUXYSCWMR6BJP5HVGOXL6D5M5WHZUPEQ6PKLCYL2KQFQ"
            },
            "device": {
                "deviceId": "amzn1.ask.device.AMA6OC6WIXPQMNZUVKDVCKEB4PXANQVTNARP6Q2MFQ2C3DM7NCDPG3M7JMMWYCH4FMORWMUKYICWKVMSZBLIBUE4OU2FQYCQA5VRY6IGXXEJGHBQJGZEAMOHIJP6O774ANWGV2O2YLUUKXJNNPRY3B7GEWTT6IKD7NEH2WPG3PV3C4E5C257I5IYR6GS4264EWUGV",
                "supportedInterfaces": {
                    "AudioPlayer": {}
                }
            },
            "apiEndpoint": "https://api.eu.amazonalexa.com",
            "apiAccessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjEifQ.eyJhdWQiOiJodHRwczovL2FwaS5ldS5hbWF6b25hbGV4YS5jb20iLCJpc3MiOiJBbGV4YVNraWxsS2l0Iiwic3ViIjoiYW16bjEuYXNrLnNraWxsLmU2MGI3NGJiLTUyNmYtNGEwNi1hNjhlLTg4ZGRjY2Y0YmYzNiIsImV4cCI6MTcxMzEzODIxNSwiaWF0IjoxNzEzMTM4MTU1LCJuYmYiOjE3MTMxMzgxNTUsInByaXZhdGVDbGFpbXMiOnsiY29udGV4dCI6IkFBQUFBQUFBQVFDVjNKTFRVeEVyVUl1MlI1KytYbWkyVFFFQUFBQUFBQUI0a0c5dDM5TnZ3Qng4TlI1UjNzQjVMUjFsSkNNQ1o0aWNndkRyUC93YmVBLzRYWFg3VkRSTUM4S1VrZDRHcFVpamEzREt0NjZ5dXpvbmxHeUJhUzV6NytwSUhUUW94Y1dHcHpuT3VUdGd1dE9HZWJmRWxoUEJTTDRWSEFMamFkSFBMNk5QZFd6cnJWSE0yN0FMWnQrcTFSYjZJSU9aZGJZVkhGZzVmeHZwMXdJZjZycDJsd1BBOVl4S05iWS9wTjlMN3VkeFM3V2dXYjBpTTZuZ24wbGlqbXNtQVloaUlwNnBBVlVpSURodExXNTlwTTd1Z0RSQko2QXEwdWhrZXJvTU1Sa1dqWFlqUHN0TlI5M0FWWEhTMnQMNZUVKDVCKEB4PXANQVTNARP6Q2kU5ajJmZkFZZ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6ZLN86RzvWvpU_R6R_1SPdP1nljf8Xpss1nxeHjKB98JVKR3GLNB_Vq_rq5diQz0VTz4GDEOFf22PMYv9QkA"
        }
    },
    "request": {
        "type": "SessionEndedRequest",
        "requestId": "amzn1.echo-api.request.4bcffdc6-ca9b-439e-b947-5376770f8f45",
        "timestamp": "2024-04-14T23:42:36Z",
        "locale": "es-ES",
        "reason": "ERROR",
        "error": {
            "type": "INVALID_RESPONSE",
            "message": "An exception occurred while dispatching the request to the skill."
        }
    }
}
eagle-phoenix commented 1 week ago

I had same problem as you. I moved the other service that was on port 5000 to another port and it started to connect to the skill. But I found another problem that I'm trying to resolve asking for it in #46

Salu2 from Spain

rosskouk commented 1 day ago

Hi @adocampo,

With debugging set to maximum on the skill do you see any logs on the skill when trying to invoke the skill from the Amazon developer portal? If everything is configured correctly you should see something even if it's just an error. If there are no logs generated by the skill could you temporally disable the service you have running on port 5000, run the skill on that port and see if that resolves the issue.

Port 5000 is used by default by the Flask library which serves the app, this can be changed according to their documentation but would require changes to both the skill code and docker file.

adocampo commented 16 hours ago

So, the yaml is right? I've created the skill once again, this is the summary image I modified the alexa.json to reflect the invocation name and changed from navisonic to reproductor musical (on the last attempt I left this untouched. image

In the Endpoint section, on the URL, I set my navidrome instance (e.g.: https://music.mydomain.com) image Which is, in fact, the URL accessible from internet image Finally, there is no "Build Model" button in the last step, but "Build Skill" image

Once built, I'm going to show how I filled the docker-compose.yml. First, NAVI_SKILL_ID, taken from the developer's console URL image then, NAVI_URL, which is the same URL above, https://music.mydomain.com. next, NAVI_USER and NAVI_PASS, which are the credentials set in navidrome image other options left by defautl except the port redirection, I obviusly left intact the internal docker port (5000), but the host port is changed from 5000 to 5555, as in port 5000 I have set frigate and it would be a pain in the ass changing it. Anyway, that's the magic of docker, while I don't touch anything inside the docker, it should work. And, I can't remember from April, but I think I did try to shutdown frigate for a while, and setting this asknavidrome docker to its default port 5000, with the same result. I've spin up the docker container and did a telnet to the redirected port 5555 successfully image

Now, it would be the time to test the skill, it fails image

Now, my questions:

adocampo commented 16 hours ago

UPDATED: I've changed the invocationName back to navisonic and now it seems to do something, but still, it doesn't work image I've tried also in my home Echoes, but it says the same: "Acabas de activar HelloWorldIntent" (You have just activated HelloWorldIntent).

Logs in the docker didn't change:

asknavidrome-1  |  * Serving Flask app 'app'
asknavidrome-1  |  * Debug mode: off
asknavidrome-1  | 2024-09-29 17:12:12,634 - werkzeug - INFO - WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
asknavidrome-1  |  * Running on all addresses (0.0.0.0)
asknavidrome-1  |  * Running on http://127.0.0.1:5000
asknavidrome-1  |  * Running on http://192.168.80.2:5000
asknavidrome-1  | 2024-09-29 17:12:12,634 - werkzeug - INFO - Press CTRL+C to quit

I've tried both NAVI_DEBUG levels 2 and 3.

adocampo commented 16 hours ago

UPDATED2: I've set an endpoint to the asknavidrome docker service at port 5555, and changed the endpoint URL in the developer's console for that Alexa skill, and rebuilt.

Same issue. Testing says I've activated the "HelloWorldIntent", whatever that means...

Logs shows something new, though, now are showing every few seconds a line of these

asknavidrome-1  | 2024-09-29 17:31:30,259 - werkzeug - INFO - 192.168.1.100 - - [29/Sep/2024 17:31:30] "GET /api/stats HTTP/1.1" 404 -
asknavidrome-1  | 2024-09-29 17:31:35,258 - werkzeug - INFO - 192.168.1.100 - - [29/Sep/2024 17:31:35] "GET /api/stats HTTP/1.1" 404 -
asknavidrome-1  | 2024-09-29 17:31:40,258 - werkzeug - INFO - 192.168.1.100 - - [29/Sep/2024 17:31:40] "GET /api/stats HTTP/1.1" 404 -
asknavidrome-1  | 2024-09-29 17:31:45,259 - werkzeug - INFO - 192.168.1.100 - - [29/Sep/2024 17:31:45] "GET /api/stats HTTP/1.1" 404 -
asknavidrome-1  | 2024-09-29 17:31:50,259 - werkzeug - INFO - 192.168.1.100 - - [29/Sep/2024 17:31:50] "GET /api/stats HTTP/1.1" 404 -
asknavidrome-1  | 2024-09-29 17:31:55,258 - werkzeug - INFO - 192.168.1.100 - - [29/Sep/2024 17:31:55] "GET /api/stats HTTP/1.1" 404 -
asknavidrome-1  | 2024-09-29 17:32:00,258 - werkzeug - INFO - 192.168.1.100 - - [29/Sep/2024 17:32:00] "GET /api/stats HTTP/1.1" 404 -
asknavidrome-1  | 2024-09-29 17:32:05,259 - werkzeug - INFO - 192.168.1.100 - - [29/Sep/2024 17:32:05] "GET /api/stats HTTP/1.1" 404 -
asknavidrome-1  | 2024-09-29 17:32:10,258 - werkzeug - INFO - 192.168.1.100 - - [29/Sep/2024 17:32:10] "GET /api/stats HTTP/1.1" 404 -
asknavidrome-1  | 2024-09-29 17:32:15,258 - werkzeug - INFO - 192.168.1.100 - - [29/Sep/2024 17:32:15] "GET /api/stats HTTP/1.1" 404 -
asknavidrome-1  | 2024-09-29 17:32:20,259 - werkzeug - INFO - 192.168.1.100 - - [29/Sep/2024 17:32:20] "GET /api/stats HTTP/1.1" 404 -
asknavidrome-1  | 2024-09-29 17:32:25,258 - werkzeug - INFO - 192.168.1.100 - - [29/Sep/2024 17:32:25] "GET /api/stats HTTP/1.1" 404 -
asknavidrome-1  | 2024-09-29 17:32:30,259 - werkzeug - INFO - 192.168.1.100 - - [29/Sep/2024 17:32:30] "GET /api/stats HTTP/1.1" 404 -

In a browser, I can see this imagen

So I decided to test if I could reach it from inside the asknavidrme docker instance

[root@samael asknavidrome]# docker exec -ti asknavidrome-asknavidrome-1 /bin/sh
/opt/asknavidrome # ls
app.py                   asknavidrome             requirements-docker.txt  requirements-full.txt    templates
/opt/asknavidrome # ping music.docampo.net
PING music.docampo.net (192.168.1.100): 56 data bytes
64 bytes from 192.168.1.100: seq=0 ttl=64 time=0.062 ms
64 bytes from 192.168.1.100: seq=1 ttl=64 time=0.083 ms
^C

/opt/asknavidrome # apk add curl
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.15/community/x86_64/APKINDEX.tar.gz
(1/5) Installing ca-certificates (20230506-r0)
(2/5) Installing brotli-libs (1.0.9-r5)
(3/5) Installing nghttp2-libs (1.46.0-r2)
(4/5) Installing libcurl (8.5.0-r0)
(5/5) Installing curl (8.5.0-r0)
Executing busybox-1.34.1-r3.trigger
Executing ca-certificates-20230506-r0.trigger
OK: 59 MiB in 32 packages
/opt/asknavidrome # curl https://music.mydomain.com/rest/get/stats
<subsonic-response xmlns="http://subsonic.org/restapi" status="failed" version="1.16.1" type="navidrome" serverVersion="0.51.1 (6d253225)" openSubsonic="true"><error code="10" message="missing parameter: &#39;u&#39;"></error></subsonic-response>/opt/asknavidrome # 

As far as I can see, it misses "u" parameter...

I'm on a dead end... any help would be much appreciated.