Closed CaptainAweesome closed 6 years ago
Hi!
Quick question: When do you get this error? At boot or after some command? Does it ever show up in Slack?
What version of Node are you running?
Node.js v6.11.2
I get this error when entering "node index.js" directly in the bash terminal.
captainaweesome:/opt/zenmusic (master) $ node index.js
U need to be running Node 7.5 or above! Try upgrading node and give it another go!
Also, your API code for Spotify might be wrong. Obviously you didn't type the whole code :-) , but there should not be any : in there.. Make sure you encoded it with base64 as described in the README.
Seems to work after upgrading to Node v8.11.3 "nvm install 8.11.3" and removing ":" from spotify apikey. Getting an Error when not connected to sonos speaker but it's likely due to the fact there's no speaker. Now for the realworld testing with a Pi and speaker. To be continued..
07-11 13:04:01:786 Received: message undefined <@UBPNEEC1L> 1531314241.000284 "list"
07-11 13:04:01:786 term list
07-11 13:04:01:788 Current queue: false
07-11 13:04:01:789 Error occurred %j { RequestError: Error: connect ECONNREFUSED 0.0.0.0:1400
at new RequestError (/opt/zenmusic/node_modules/request-promise-core/lib/errors.js:14:15)
at Request.plumbing.callback (/opt/zenmusic/node_modules/request-promise-core/lib/plumbing.js:87:29)
at Request.RP$callback [as _callback] (/opt/zenmusic/node_modules/request-promise-core/lib/plumbing.js:46:31)
at self.callback (/opt/zenmusic/node_modules/request/request.js:185:22)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at Request.onRequestError (/opt/zenmusic/node_modules/request/request.js:877:8)
at emitOne (events.js:116:13)
at ClientRequest.emit (events.js:211:7)
at Socket.socketErrorListener (_http_client.js:387:9)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at emitErrorNT (internal/streams/destroy.js:64:8)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
name: 'RequestError',
message: 'Error: connect ECONNREFUSED 0.0.0.0:1400',
cause:
{ Error: connect ECONNREFUSED 0.0.0.0:1400
at Object._errnoException (util.js:992:11)
at _exceptionWithHostPort (util.js:1014:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '0.0.0.0',
port: 1400 },
error:
{ Error: connect ECONNREFUSED 0.0.0.0:1400
at Object._errnoException (util.js:992:11)
at _exceptionWithHostPort (util.js:1014:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '0.0.0.0',
port: 1400 },
options:
{ uri: 'http://0.0.0.0:1400/MediaRenderer/AVTransport/Control',
method: 'POST',
headers:
{ SOAPAction: '"urn:schemas-upnp-org:service:AVTransport:1#GetTransportInfo"',
'Content-type': 'text/xml; charset=utf8' },
body: '
Good news! To verify your spotify account, simply try the "search" function. Should work without connection to the Sonos.
I think there's a problem when searching:
07-12 06:14:36:938 Setting Spotify region to EU... 07-12 06:14:36:940 SE warn: SlackDataStore is deprecated and will be removed in the next major version. See project documentation for a migration guide. 07-12 06:14:38:284 Online! 07-12 06:14:53:194 Received: message undefined <@UBPNEEC1L> 1531376092.000173 "search One" 07-12 06:14:53:194 term search 07-12 06:15:02:255 Received: message undefined <@undefined> 1531376102.000020 "undefined" 07-12 06:15:02:256 Could not respond. text was undefined.
I used Base64 with UTF-8 for both Spotify client_id and client_secret. Keys look like this: OTNjYmE5OG...=Nzc1YzU5NTM...=
Also, my channel #spotify doesn't do anything. What is the use case for it?
Spotify for developers dashboard says: No data available. Check back when you've made some requests using this app for data.
which means it's not getting any requests from the bot
So the : should be there before turning it into base64 encoding.
See bellow: To get the keys, log in to Spotify and go to: https://developer.spotify.com/my-applications/#!/applications Create an app and get the two values: Client ID and Client Secret.
When you have received these values, encode them with Base64. Head over to https://www.base64encode.org and decode to base64.
You should paste something like: dfh543455dfgr44455dfgbgd4544fff:r55666655444333fbg332de34f444f4r (note the : between ClientID and Client Secret)
You should now have received something like: GhgyGKHJK45HJKHSDdvkjhKJHkjhdfkjKJHkjh334kjhKJhkjdh777JKJHCXKJCJKkj234kjkjhKJHkjhdcvdcj=
Put this value in the config.json as "apiKey": "apiKey": ""
BR Tilly
Thank you very much for the quick reply and easy fix! It seems to search for songs without problems But maybe it could have been explained in the instructions, step-by-step. :)
Note that I am running this on a VM without access to a sonos speaker at the moment.
Terminal output:
/opt/zenmusic/node_modules/sonos/lib/sonos.js:66 var implicitListen = async function (event, listener) { ^^^^^^^^
SyntaxError: Unexpected token function at createScript (vm.js:56:10) at Object.runInThisContext (vm.js:97:10) at Module._compile (module.js:542:28) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object. (/opt/zenmusic/node_modules/sonos/index.js:1:80)
config.json:
{ "adminChannel" : "spotify", "standardChannel" : "spotify", "gongLimit": 3, "voteLimit": 6, "sonos" : "", "token" : "xoxb...", "market" : "US", "maxVolume" : 75, "blacklist" : "@justin.bieber, @one.direction", "apiKey": "abc...:abc..." }