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

500 Error from browser request to play Spotify track #777

Closed foxtech60 closed 3 years ago

foxtech60 commented 3 years ago

Hi, I am running v14.12.0 of NodeJS and the latest release of node-sonos-http-api running on a RaspberryPi4. I have success running basic requests: http://192.168.1.27:5005/ http://192.168.1.27:5005/zones http://192.168.1.27:5005/state http://192.168.1.27:5005/Rumpus%20Room/play http://192.168.1.27:5005/Rumpus%20Room/pause http://192.168.1.27:5005/Rumpus%20Room/playpause However when I make a request to play a Spotify track or album I get a 500 error Failed requests are: http://192.168.1.27:5005/Rumpus%20Room/spotify/now/spotify:track:2nVHqZbOGkKWzlcy1aMbE7 http://192.168.1.27:5005/Rumpus%20Room/spotify/now/spotify:album:2dfTV7CktUEBkZCHiB7VQB Error received is: { "status":"error","error":"Got status 500 when invoking /MediaRenderer/AVTransport/Control", "stack":"Error: Got status 500 when invoking /MediaRenderer/AVTransport/Control\n at Object.invoke (/home/pi/Projects/node-sonos-http-api/node_modules/sonos-discovery/lib/helpers/soap.js:99:10)\n at Player.addURIToQueue (/home/pi/Projects/node-sonos-http-api/node_modules/sonos-discovery/lib/models/Player.js:616:15)\n
at /home/pi/Projects/node-sonos-http-api/lib/actions/spotify.js:37:33" } Any help or advice would be greatly appreciated.

jishi commented 3 years ago

That error means that your players don't approve the action taken, looks like it fails when trying to add the spotify URI in the queue.

Do you have a valid Spotify account added in your Sonos service list?

You get the same kind of error if you just do /spotify/queue/[uri] ?

If you have the possibility to run it with trace-logging enabled, you would get a log with the exact commands sent to the players. Start it with:

NODE_LOG_LEVEL=trace npm start > trace.log

invoke the command, stop it, then email the trace.log file to me at jimmy at shimizu.se and I can have a look to see if something stands out. I haven't tested it with Node 14 either, so if you feel like downgrading, that could be something to try.

foxtech60 commented 3 years ago

Thanks for your advice mate. I will give all this a try...

foxtech60 commented 3 years ago

Well that was embarrasing. I hadn't added my spotify account to my Sonos service list. It is all working perfectly now thank you. At lease I have proven that Node 14 works OK :-) Sorry for the interuption, but thanks for yhour help...