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.

Home Page:http://jishi.github.io/node-sonos-http-api/

Repository from Github https://github.comjishi/node-sonos-http-apiRepository from Github https://github.comjishi/node-sonos-http-api

Is there a way to see the requested URL?

WhileDekker opened this issue · comments

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

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.

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:

  • It didnt work changing the server.js directly in the docker container as this change seems to require a restart - so i changed it in a mounted server.js and that worked fine.

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