jishi / node-sonos-http-api

An HTTP API bridge for Sonos easing automation. Hostable on any node.js capable device, like a raspberry pi or similar.
http://jishi.github.io/node-sonos-http-api/
MIT License
1.83k stars 462 forks source link

Is there a way to see the requested URL? #846

Closed WhileDekker closed 1 year ago

WhileDekker commented 1 year ago

Hey,

I am facing an issue when calling the API from the Sonos Kids Controller for some particular files it fails.

API says: 2022-07-30T19:39:46.883Z ERROR No matches were found

I am pretty sure the file is there and everything is correct, but to further debug I would like to see what URL is called by the Sonos Kids Controller towards the API. Unfortunately I havent found any log or a way to see how the API (URL!) was called by the the Sonos Kids Controller.

If nothing helps I can only think of putting some proxy in between to get more visibility,

NOTE: I am running both API and Sonos Kids Controller in Docker

Any help/hint would be much appreciated.

Cheers

jishi commented 1 year ago

Easiest would be to just add some log row into server.js, first row in the requestHandler: https://github.com/jishi/node-sonos-http-api/blob/master/server.js#L16

the req object will contain the url on some property (.url it seems, see https://nodejs.org/api/http.html#messageurl) so you could just console log that.

You can either edit it directly in the docker container (which would just be a change that lives while the container is alive), or you can mount a copy of the server.js file when starting the container with volume mount.

WhileDekker commented 1 year ago

Gr8 - That helped a lot

I added this console log statement after line 16 like this. var requestHandler = function (req, res) { console.log(req.url)

Takeaway:

I can now debug why some of the Sonos Kids Controller calls fail, if this is related to the Sonos API i guess i will come back to you.

Thanks for help

issue closed

jishi commented 1 year ago

You could always put a logging row in the server.js file first in the request handler, and log the path requested, which seems easier than setting up a proxy.

If you are comfortable Linux user you can do that change directly in docker (using exec), or you can mount a copy of server.js from the host filesystem and edit it before starting docker.

On Sat, 30 Jul 2022, 21:55 WhileDekker, @.***> wrote:

Hey,

I am facing an issue when calling the API from the Sonos Kids Controller for some particular files it fails.

API says: 2022-07-30T19:39:46.883Z ERROR No matches were found

I am pretty sure the file is there and everything is correct, but to further debug I would like to see what URL is called by the Sonos Kids Controller towards the API. Unfortunately I havent found any log or a way to see how the API (URL!) was called by the the Sonos Kids Controller.

If nothing helps I can only think of putting some proxy in between to get more visibility,

NOTE: I am running both API and Sonos Kids Controller in Docker

Any help/hint would be much appreciated.

Cheers

— Reply to this email directly, view it on GitHub https://github.com/jishi/node-sonos-http-api/issues/846, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYE2I4K26Q666VCX5QHZNDVWWCBRANCNFSM55DWWJAQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>