Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

500 when trying to play stream #433

Closed
johneas10 opened this issue Jul 29, 2019 · 12 comments

Comments

@johneas10
Copy link

commented Jul 29, 2019

Seem to be receiving the same error as noted here: #422

SONOS_HOST=192.168.X.X node examples/playthis.js returns the 500 error.

I can pause/play existing queues and change volume no problem.

node 10.15.3
node-sonos: 1.12.2
sonos controller version: 10.3
macOS 10.14.6

checked out the Sonos changelog but I there's nothing obvious: https://support.sonos.com/s/article/3521?language=en_US

I've had a quick look with Wireshark and I can see the following...

        <s:Body>
            <s:Fault>
                <faultcode>
                    s:Client
                    </faultcode>
                <faultstring>
                    UPnPError
                    </faultstring>
                <detail>
                    <UPnPError
                        xmlns="urn:schemas-upnp-org:control-1-0">
                        <errorCode>
                            711
                            </errorCode>
                        </UPnPError>
                    </detail>
                </s:Fault>
            </s:Body>

...along with some 404s

@svrooij svrooij added the need-info label Jul 30, 2019

@svrooij

This comment has been minimized.

Copy link
Collaborator

commented Jul 30, 2019

Can you show us the export of this command?
SONOS_HOST=192.168.x.x DEBUG=sonos* node examples/playthis.js

This will give us something to work-out.

I'm on the Mac 10.14.5, Node 11.14.0, node-sonos current master and this is what I get.

  sonos:main Sonos.play("https://archive.org/download/testmp3testfile/mpthreetest.mp3") +0ms
  sonos:main Sonos.queue("https://archive.org/download/testmp3testfile/mpthreetest.mp3", 0) +2ms
  sonos:helpers Returning string because it isn't recognized +0ms
  sonos:service Service._request("AddURIToQueue" {"InstanceID":0,"EnqueuedURI":"https://archive.org/download/testmp3testfile/mpthreetest.mp3","EnqueuedURIMetaData":"","DesiredFirstTrackNumberEnqueued":0,"EnqueueAsNext":1}) +0ms
  sonos:helpers Helpers.ParseXml "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><s:Body><u:AddURIToQueueResponse xmlns:u=\"urn:schemas-upnp-org:service:AVTransport:1\"><FirstTrackNumberEnqueued>102</FirstTrackNumberEnqueued><NumTracksAdded>1</NumTracksAdded><NewQueueLength>102</NewQueueLength></u:AddURIToQueueResponse></s:Body></s:Envelope>" +40ms
  sonos:service Parsed service response as JSON
  sonos:service {
  "s:Envelope": {
    "xmlns:s": "http://schemas.xmlsoap.org/soap/envelope/",
    "s:encodingStyle": "http://schemas.xmlsoap.org/soap/encoding/",
    "s:Body": {
      "u:AddURIToQueueResponse": {
        "xmlns:u": "urn:schemas-upnp-org:service:AVTransport:1",
        "FirstTrackNumberEnqueued": "102",
        "NumTracksAdded": "1",
        "NewQueueLength": "102"
      }
    }
  }
} +46ms
  sonos:main Sonos.selectTrack("102") +47ms
  sonos:service Service._request("Seek" {"InstanceID":0,"Unit":"TRACK_NR","Target":"102"}) +0ms
  sonos:helpers Helpers.ParseXml "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><s:Body><u:SeekResponse xmlns:u=\"urn:schemas-upnp-org:service:AVTransport:1\"></u:SeekResponse></s:Body></s:Envelope>" +24ms
  sonos:service Parsed service response as JSON
  sonos:service {
  "s:Envelope": {
    "xmlns:s": "http://schemas.xmlsoap.org/soap/envelope/",
    "s:encodingStyle": "http://schemas.xmlsoap.org/soap/encoding/",
    "s:Body": {
      "u:SeekResponse": {
        "xmlns:u": "urn:schemas-upnp-org:service:AVTransport:1"
      }
    }
  }
} +19ms
  sonos:main Sonos.play(undefined) +19ms
  sonos:service Service._request("Play" {"InstanceID":0,"Speed":1}) +0ms
  sonos:helpers Helpers.ParseXml "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><s:Body><u:PlayResponse xmlns:u=\"urn:schemas-upnp-org:service:AVTransport:1\"></u:PlayResponse></s:Body></s:Envelope>" +13ms
  sonos:service Parsed service response as JSON
  sonos:service {
  "s:Envelope": {
    "xmlns:s": "http://schemas.xmlsoap.org/soap/envelope/",
    "s:encodingStyle": "http://schemas.xmlsoap.org/soap/encoding/",
    "s:Body": {
      "u:PlayResponse": {
        "xmlns:u": "urn:schemas-upnp-org:service:AVTransport:1"
      }
    }
  }
} +12ms
Yeay
@johneas10

This comment has been minimized.

Copy link
Author

commented Jul 30, 2019

Thanks for the info. I’ll run this when I get home

@johneas10

This comment has been minimized.

Copy link
Author

commented Jul 30, 2019

Here you go @svrooij

  sonos:main Sonos.play("https://archive.org/download/testmp3testfile/mpthreetest.mp3") +0ms
  sonos:main Sonos.queue("https://archive.org/download/testmp3testfile/mpthreetest.mp3", 0) +3ms
  sonos:helpers Returning string because it isn't recognized +0ms
  sonos:service Service._request("AddURIToQueue" {"InstanceID":0,"EnqueuedURI":"https://archive.org/download/testmp3testfile/mpthreetest.mp3","EnqueuedURIMetaData":"","DesiredFirstTrackNumberEnqueued":0,"EnqueueAsNext":1}) +0ms
  sonos:helpers Helpers.ParseXml "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><s:Body><u:AddURIToQueueResponse xmlns:u=\"urn:schemas-upnp-org:service:AVTransport:1\"><FirstTrackNumberEnqueued>23</FirstTrackNumberEnqueued><NumTracksAdded>1</NumTracksAdded><NewQueueLength>23</NewQueueLength></u:AddURIToQueueResponse></s:Body></s:Envelope>" +37ms
  sonos:service Parsed service response as JSON
  sonos:service {
  "s:Envelope": {
    "xmlns:s": "http://schemas.xmlsoap.org/soap/envelope/",
    "s:encodingStyle": "http://schemas.xmlsoap.org/soap/encoding/",
    "s:Body": {
      "u:AddURIToQueueResponse": {
        "xmlns:u": "urn:schemas-upnp-org:service:AVTransport:1",
        "FirstTrackNumberEnqueued": "23",
        "NumTracksAdded": "1",
        "NewQueueLength": "23"
      }
    }
  }
} +45ms
  sonos:main Sonos.selectTrack("23") +46ms
  sonos:service Service._request("Seek" {"InstanceID":0,"Unit":"TRACK_NR","Target":"23"}) +0ms
Error occurred {"message":"Request failed with status code 500","name":"Error","stack":"Error: Request failed with status code 500\n    at createError (/Users/john/dev/node-sonos/node_modules/axios/lib/core/createError.js:16:15)\n    at settle (/Users/john/dev/node-sonos/node_modules/axios/lib/core/settle.js:17:12)\n    at IncomingMessage.handleStreamEnd (/Users/john/dev/node-sonos/node_modules/axios/lib/adapters/http.js:237:11)\n    at IncomingMessage.emit (events.js:194:15)\n    at endReadableNT (_stream_readable.js:1125:12)\n    at process._tickCallback (internal/process/next_tick.js:63:19)","config":{"url":"http://192.168.1.13:1400/MediaRenderer/AVTransport/Control","method":"post","data":"<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><s:Body><u:Seek xmlns:u=\"urn:schemas-upnp-org:service:AVTransport:1\"><InstanceID>0</InstanceID><Unit>TRACK_NR</Unit><Target>23</Target></u:Seek></s:Body></s:Envelope>","headers":{"Accept":"application/json, text/plain, */*","Content-Type":"text/xml; charset=utf8","SOAPAction":"\"urn:schemas-upnp-org:service:AVTransport:1#Seek\"","User-Agent":"axios/0.19.0","Content-Length":290},"transformRequest":[null],"transformResponse":[null],"timeout":0,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1}}
@johneas10

This comment has been minimized.

Copy link
Author

commented Jul 30, 2019

Ok I've just finished factory resetting my system and started from scratch. Seems to be working okay now. Maybe something didn't configure properly in the latest update.

Sorry for the pointless issue 😩

@johneas10 johneas10 closed this Jul 30, 2019

@svrooij

This comment has been minimized.

Copy link
Collaborator

commented Jul 30, 2019

Doesn’t matter, maybe we can make it even clearer how to create viable logging so we can diagnose problems faster.

@Mastiffen

This comment has been minimized.

Copy link

commented Aug 2, 2019

I have a similar problem on a newly installed Sonos (IKEA, but it's supposedly identical to Sonus One on the inside). But on my Sonos there's just nothing happening at all, no debug or anything. Where do I run that SONOS_HOST=192.168.x.x DEBUG=sonos* node examples/playthis.js command? (Sorry if it's a dumb question.)

@johneas10

This comment has been minimized.

Copy link
Author

commented Aug 2, 2019

Pull this project down & install, open the folder in your terminal and run the script there.

@Mastiffen

This comment has been minimized.

Copy link

commented Aug 2, 2019

I have installed it, and I have found the folder but have no idea how to run the script. I'm a Windows man and know close to nothing about Linux, sorry... Do I save it as a file?

@Mastiffen

This comment has been minimized.

Copy link

commented Aug 2, 2019

I tried to run it from the command line:

` SONOS_HOST=192.168.2.216 DEBUG=sonos* node examples/playthis.js
module.js:550
throw err;
^

Error: Cannot find module '/home/pi/.node-red/node_modules/sonos/examples/playthis.js'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3
`

@Mastiffen

This comment has been minimized.

Copy link

commented Aug 2, 2019

OK, sorry. I downloaded the full package (I thought installation was enough) and ran the code:

SONOS_HOST=192.168.2.216 DEBUG=sonos* node examples/playthis.js
sonos Sonos.play("https://archive.org/download/testmp3testfile/mpthreetest.mp3", undefined) +0ms
sonos Returning string because it isn't recognized +9ms
sonos Sonos.queue({"uri":"https://archive.org/download/testmp3testfile/mpthreetest.mp3"}, undefined, undefined) +2ms
sonos Sonos.request("/MediaRenderer/AVTransport/Control", ""urn:schemas-upnp-org:service:AVTransport:1#AddURIToQueue"", "<u:AddURIToQueue xmlns:u="urn:schemas-upnp-org:service:AVTransport:1">0https://archive.org/download/testmp3testfile/mpthreetest.mp301</u:AddURIToQueue>", "u:AddURIToQueueResponse", undefined) +1ms
/home/pi/.node-red/node_modules/sonos/examples/playthis.js:4
sonos.play('https://archive.org/download/testmp3testfile/mpthreetest.mp3').then(success => {
^

TypeError: Cannot read property 'then' of undefined
at Object. (/home/pi/.node-red/node_modules/sonos/examples/playthis.js:4:75)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3

@svrooij

This comment has been minimized.

Copy link
Collaborator

commented Aug 3, 2019

@Mastiffen your installation doesn't seem normal. What are you trying to accomplish?

Also this issue seems not really related to the closed issue where you posted your question in.

If you want to use Sonos in your node-red installation you should check one of the packages specific for node-red (which will use this package internally, if I'm correct)

If you create a new issue you'll be asked a few questions like node version, os, os version and the node-sonos version.

The examples aren't included in the npm install because people wanting the examples probably use the code straight from GitHub.

@Mastiffen

This comment has been minimized.

Copy link

commented Aug 3, 2019

Sorry, I was directed to this issue by somebody at the Node-RED discourse. I'll open a new issue (if that's what it's called) for the node.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.