htilly / zenmusic

Slack / Sonos / Spotify / Node.js - Control Sonos through #Slack
125 stars 36 forks source link

Connecting zenbot to Sonos - StatusCodeError: 500 #39

Closed CaptainAweesome closed 6 years ago

CaptainAweesome commented 6 years ago

Hello, I'm having trouble playing songs on sonos speaker.

"status" command in Slack says: Sonos state is 'stopped'

"search" command in Slack works. I have entered the ip of the speaker into config.json and other cridentials needed there.

CaptainAweesome commented 6 years ago

08-07 14:03:48:771 Setting Spotify region to EU... 08-07 14:03:48:779 SE warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide. 08-07 14:03:55:335 Online! 08-07 14:04:05:070 Received: message undefined <@UBD6NKEHZ> 1533643452.000041 "help" 08-07 14:04:05:071 term help 08-07 14:04:23:079 Received: message undefined <@UBD6NKEHZ> 1533643463.000007 "search One Metallica" 08-07 14:04:23:079 term search 08-07 14:04:24:646 { tracks: { href: 'https://api.spotify.com/v1/search?query=One+Metallica&type=track&market=SE&offset=0&limit=7', items: [ [Object], [Object], [Object], [Object], [Object], [Object], [Object] ], limit: 7, next: 'https://api.spotify.com/v1/search?query=One+Metallica&type=track&market=SE&offset=7&limit=7', offset: 0, previous: null, total: 304 } } 08-07 14:04:33:978 Received: message undefined <@UBD6NKEHZ> 1533643473.000284 "status" 08-07 14:04:33:979 term status 08-07 14:04:34:128 Got current state: stopped 08-07 14:05:15:186 Received: message undefined <@UBD6NKEHZ> 1533643515.000040 "add One Metallica" 08-07 14:05:15:186 term add 08-07 14:05:16:655 { tracks: { href: 'https://api.spotify.com/v1/search?query=One+Metallica&type=track&market=SE&offset=0&limit=1', items: [ [Object] ], limit: 1, next: 'https://api.spotify.com/v1/search?query=One+Metallica&type=track&market=SE&offset=1&limit=1', offset: 0, previous: null, total: 304 } } 08-07 14:05:16:656 Adding track: Metallica - One with UID: spotify:track:5IX4TbIR5mMHGE4wiWwKW0 08-07 14:05:16:678 Got current state: stopped 08-07 14:05:16:679 State: stopped - flushing 08-07 14:05:16:682 DEBUG addToSpotify spotify:track:5IX4TbIR5mMHGE4wiWwKW0 08-07 14:05:16:686 Adding track: Metallica - One 08-07 14:05:17:393 Flushed queue: {} 08-07 14:05:17:400 Queued the following: { FirstTrackNumberEnqueued: '1', NumTracksAdded: '1', NewQueueLength: '1' } 08-07 14:05:17:401 DEBUG queue: 08-07 14:05:17:401 queueLength 1 08-07 14:05:17:709 Error occurred: { StatusCodeError: 500 - "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">s:ClientUPnPError<UPnPError xmlns=\"urn:schemas-upnp-org:control-1-0\">701</s:Fault></s:Body></s:Envelope>" at new StatusCodeError (/opt/zenmusic/node_modules/request-promise-core/lib/errors.js:32:15) at Request.plumbing.callback (/opt/zenmusic/node_modules/request-promise-core/lib/plumbing.js:104:33) at Request.RP$callback [as _callback] (/opt/zenmusic/node_modules/request-promise-core/lib/plumbing.js:46:31) at Request.self.callback (/opt/zenmusic/node_modules/request/request.js:185:22) at Request.emit (events.js:182:13) at Request. (/opt/zenmusic/node_modules/request/request.js:1157:10) at Request.emit (events.js:182:13) at IncomingMessage. (/opt/zenmusic/node_modules/request/request.js:1079:12) at Object.onceWrapper (events.js:273:13) at IncomingMessage.emit (events.js:187:15) at endReadableNT (_stream_readable.js:1081:12) at process._tickCallback (internal/process/next_tick.js:63:19) name: 'StatusCodeError', statusCode: 500, message: '500 - "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" s:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">s:ClientUPnPError<UPnPError xmlns=\"urn:schemas-upnp-org:control-1-0\">701</s:Fault></s:Body></s:Envelope>"', error: 's:ClientUPnPError701</s:Fault></s:Body></s:Envelope>', options: { uri: 'http://192.168.7.161:1400/MediaRenderer/AVTransport/Control', method: 'POST', headers: { SOAPAction: '"urn:schemas-upnp-org:service:AVTransport:1#Play"', 'Content-type': 'text/xml; charset=utf8' }, body: '01</u:Play></s:Body></s:Envelope>', callback: [Function: RP$callback], transform: undefined, simple: true, resolveWithFullResponse: false, transform2xxOnly: false }, response: IncomingMessage { _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: BufferList { length: 0 }, length: 0, pipes: null, pipesCount: 0, flowing: true, ended: true, endEmitted: true, reading: false, sync: true, needReadable: false, emittedReadable: false, readableListening: false, resumeScheduled: false, emitClose: true, destroyed: false, defaultEncoding: 'utf8', awaitDrain: 0, readingMore: true, decoder: null, encoding: null }, readable: false, _events: { end: [Array], close: [Array], data: [Function], error: [Function] }, _eventsCount: 4, _maxListeners: undefined, socket: Socket { connecting: false, _hadError: false, _handle: [TCP], _parent: null, _host: null, _readableState: [ReadableState], readable: true, _events: [Object], _eventsCount: 7, _maxListeners: undefined, _writableState: [WritableState], writable: false, allowHalfOpen: false, _sockname: null, _pendingData: null, _pendingEncoding: '', server: null, _server: null, parser: null, _httpMessage: [ClientRequest],

    [Symbol(lastWriteQueueSize)]: 0,
    [Symbol(timeout)]: null,
    [Symbol(kBytesRead)]: 0,
    [Symbol(kBytesWritten)]: 0 },
 connection:
  Socket {
    connecting: false,
    _hadError: false,
    _handle: [TCP],
    _parent: null,
    _host: null,
    _readableState: [ReadableState],
    readable: true,
    _events: [Object],
    _eventsCount: 7,
    _maxListeners: undefined,
    _writableState: [WritableState],
    writable: false,
    allowHalfOpen: false,
    _sockname: null,
    _pendingData: null,
    _pendingEncoding: '',
    server: null,
    _server: null,
    parser: null,
    _httpMessage: [ClientRequest],
    [Symbol(asyncId)]: 228,
    [Symbol(lastWriteQueueSize)]: 0,
    [Symbol(timeout)]: null,
    [Symbol(kBytesRead)]: 0,
    [Symbol(kBytesWritten)]: 0 },
 httpVersionMajor: 1,
 httpVersionMinor: 1,
 httpVersion: '1.1',
 complete: true,
 headers:
  { 'content-length': '347',
    'content-type': 'text/xml; charset="utf-8"',
    ext: '',
    server: 'Linux UPnP/1.0 Sonos/44.2-54230 (ZPS3)',
    connection: 'close' },
 rawHeaders:
  [ 'CONTENT-LENGTH',
    '347',
    'CONTENT-TYPE',
    'text/xml; charset="utf-8"',
    'EXT',
    '',
    'Server',
    'Linux UPnP/1.0 Sonos/44.2-54230 (ZPS3)',
    'Connection',
    'close' ],
 trailers: {},
 rawTrailers: [],
 aborted: false,
 upgrade: false,
 url: '',
 method: null,
 statusCode: 500,
 statusMessage: 'Internal Server Error',
 client:
  Socket {
    connecting: false,
    _hadError: false,
    _handle: [TCP],
    _parent: null,
    _host: null,
    _readableState: [ReadableState],
    readable: true,
    _events: [Object],
    _eventsCount: 7,
    _maxListeners: undefined,
    _writableState: [WritableState],
    writable: false,
    allowHalfOpen: false,
    _sockname: null,
    _pendingData: null,
    _pendingEncoding: '',
    server: null,
    _server: null,
    parser: null,
    _httpMessage: [ClientRequest],
    [Symbol(asyncId)]: 228,
    [Symbol(lastWriteQueueSize)]: 0,
    [Symbol(timeout)]: null,
    [Symbol(kBytesRead)]: 0,
    [Symbol(kBytesWritten)]: 0 },
 _consuming: false,
 _dumped: false,
 req:
  ClientRequest {
    _events: [Object],
    _eventsCount: 5,
    _maxListeners: undefined,
    output: [],
    outputEncodings: [],
    outputCallbacks: [],
    outputSize: 0,
    writable: true,
    _last: true,
    chunkedEncoding: false,
    shouldKeepAlive: false,
    useChunkedEncodingByDefault: true,
    sendDate: false,
    _removedConnection: false,
    _removedContLen: false,
    _removedTE: false,
    _contentLength: null,
    _hasBody: true,
    _trailer: '',
    finished: true,
    _headerSent: true,
    socket: [Socket],
    connection: [Socket],
    _header:
     'POST /MediaRenderer/AVTransport/Control HTTP/1.1\r\nSOAPAction: "urn:schemas-upnp-org:service:AVTransport:1#Play"\r\nContent-type: text/xml; charset=utf8\r\nhost: 192.168.7.161:1400\r\ncontent-length: 266\r\nConnection: close\r\n\r\n',
    _onPendingData: [Function: noopPendingOutput],
    agent: [Agent],
    socketPath: undefined,
    timeout: undefined,
    method: 'POST',
    path: '/MediaRenderer/AVTransport/Control',
    _ended: true,
    res: [Circular],
    aborted: undefined,
    timeoutCb: null,
    upgradeOrConnect: false,
    parser: null,
    maxHeadersCount: null,
    [Symbol(isCorked)]: false,
    [Symbol(outHeadersKey)]: [Object] },
 request:
  Request {
    _events: [Object],
    _eventsCount: 5,
    _maxListeners: undefined,
    uri: [Url],
    method: 'POST',
    headers: [Object],
    body:
     '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:Play xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID><Speed>1</Speed></u:Play></s:Body></s:Envelope>',
    readable: true,
    writable: true,
    explicitMethod: true,
    _qs: [Querystring],
    _auth: [Auth],
    _oauth: [OAuth],
    _multipart: [Multipart],
    _redirect: [Redirect],
    _tunnel: [Tunnel],
    _rp_resolve: [Function],
    _rp_reject: [Function],
    _rp_promise: [Promise],
    _rp_callbackOrig: undefined,
    callback: [Function],
    _rp_options: [Object],
    setHeader: [Function],
    hasHeader: [Function],
    getHeader: [Function],
    removeHeader: [Function],
    localAddress: undefined,
    pool: {},
    dests: [],
    __isRequestRequest: true,
    _callback: [Function: RP$callback],
    proxy: null,
    tunnel: false,
    setHost: true,
    originalCookieHeader: undefined,
    _disableCookies: true,
    _jar: undefined,
    port: '1400',
    host: '192.168.7.161',
    path: '/MediaRenderer/AVTransport/Control',
    httpModule: [Object],
    agentClass: [Function],
    agent: [Agent],
    _started: true,
    href:
     'http://192.168.7.161:1400/MediaRenderer/AVTransport/Control',
    req: [ClientRequest],
    ntick: true,
    response: [Circular],
    originalHost: '192.168.7.161:1400',
    originalHostHeaderName: 'host',
    responseContent: [Circular],
    _destdata: true,
    _ended: true,
    _callbackCalled: true },
 toJSON: [Function: responseToJSON],
 caseless: Caseless { dict: [Object] },
 body:
  '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><s:Fault><faultcode>s:Client</faultcode><faultstring>UPnPError</faultstring><detail><UPnPError xmlns="urn:schemas-upnp-org:control-1-0"><errorCode>701</errorCode></UPnPError></detail></s:Fault></s:Body></s:Envelope>' } }

08-07 14:05:17:793 Received: message undefined <@undefined> 1533643517.000253 "undefined" 08-07 14:05:17:794 Could not respond. text was undefined. 08-07 14:05:23:946 Received: message undefined <@UBD6NKEHZ> 1533643523.000297 "play" 08-07 14:05:23:946 term play

CaptainAweesome commented 6 years ago

I solved it by playing a song from Sonos app and then restarting zenbot scripts