Repeated Warnings
dsvobo opened this issue · 11 comments
I don't know that much about JS and I followed all of the instructions thoroughly... here are the logs
C:\Users\DSsvo\Desktop\Discord-Spotify-RPC-master>npm start
> discord-spotify-rpc@1.1.0 start C:\Users\DSsvo\Desktop\Discord-Spotify-RPC-master
> node index.js
Starting with clientId ******************
[11:00:57 PM] Updated RPC rich presence - Sleep Like A Baby Tonight
(node:26192) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: (Date.now(...) - EPOCH).toString(...).padStart is not a function
(node:26192) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[11:01:11 PM] Updated RPC rich presence - Sleep Like A Baby Tonight
(node:26192) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: (Date.now(...) - EPOCH).toString(...).padStart is not a function
[11:01:26 PM] Updated RPC rich presence - Sleep Like A Baby Tonight
(node:26192) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): TypeError: (Date.now(...) - EPOCH).toString(...).padStart is not a function
[11:01:41 PM] Updated RPC rich presence - Sleep Like A Baby Tonight
(node:26192) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): TypeError: (Date.now(...) - EPOCH).toString(...).padStart is not a function
[11:01:56 PM] Updated RPC rich presence - Sleep Like A Baby Tonight
(node:26192) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 5): TypeError: (Date.now(...) - EPOCH).toString(...).padStart is not a function
This repeats while the RP never shows up in Discord.
Having the same issue, catching the exception will see if I can find a solution.
Here's the exception caught with:
process.on('unhandledRejection', (reason, p) => { console.log('Unhandled Rejection at: Promise', p, 'reason:', reason); // application specific logging, throwing an error, or other logic here });
Exception:
Unhandled Rejection at: Promise Promise { <rejected> TypeError: (Date.now(...) - EPOCH).toString(...).padStart is not a function at Function.generate (C:\Users\Ministry\Desktop\Discord-Spotify-RPC-master\node_modules\discord.js\src\util\Snowflake.js:35:56) at Promise (C:\Users\Ministry\Desktop\Discord-Spotify-RPC-master\node_modules\discord-rpc\src\Client.js:139:31) at RPCClient.request (C:\Users\Ministry\Desktop\Discord-Spotify-RPC-master\node_modules\discord-rpc\src\Client.js:138:12) at RPCClient.setActivity (C:\Users\Ministry\Desktop\Discord-Spotify-RPC-master\node_modules\discord-rpc\src\Client.js:478:17) at C:\Users\Ministry\Desktop\Discord-Spotify-RPC-master\index.js:31:11 at Request._callback (C:\Users\Ministry\Desktop\Discord-Spotify-RPC-master\node_modules\node-spotify-webhelper\index.js:56:16) at Request.self.callback (C:\Users\Ministry\Desktop\Discord-Spotify-RPC-master\node_modules\request\request.js:186:22) at emitTwo (events.js:106:13) at Request.emit (events.js:194:7) at Request.<anonymous> (C:\Users\Ministry\Desktop\Discord-Spotify-RPC-master\node_modules\request\request.js:1163:10) } reason: TypeError: (Date.now(...) - EPOCH).toString(...).padStart is not a function at Function.generate (C:\Users\Ministry\Desktop\Discord-Spotify-RPC-master\node_modules\discord.js\src\util\Snowflake.js:35:56) at Promise (C:\Users\Ministry\Desktop\Discord-Spotify-RPC-master\node_modules\discord-rpc\src\Client.js:139:31) at RPCClient.request (C:\Users\Ministry\Desktop\Discord-Spotify-RPC-master\node_modules\discord-rpc\src\Client.js:138:12) at RPCClient.setActivity (C:\Users\Ministry\Desktop\Discord-Spotify-RPC-master\node_modules\discord-rpc\src\Client.js:478:17) at C:\Users\Ministry\Desktop\Discord-Spotify-RPC-master\index.js:31:11 at Request._callback (C:\Users\Ministry\Desktop\Discord-Spotify-RPC-master\node_modules\node-spotify-webhelper\index.js:56:16) at Request.self.callback (C:\Users\Ministry\Desktop\Discord-Spotify-RPC-master\node_modules\request\request.js:186:22) at emitTwo (events.js:106:13) at Request.emit (events.js:194:7) at Request.<anonymous> (C:\Users\Ministry\Desktop\Discord-Spotify-RPC-master\node_modules\request\request.js:1163:10)
Seems like a problem related to Node.js. What version are you guys running on?
Run node -v
in cmd to see what Node.js version you are running.
AFAIK this project requires at least v8.x.x
and I have no problems running.
I'm running 7.10.0. How do I update? I'm such a noob when it comes to Node.js
@mrfizzl3 Download the latest LTS here: https://nodejs.org/en/download/
I've had the same issue, for some reason (at least some versions of) node don't ship with the padStart function. There are polyfills available online though that easily fix the issue.
Use pm2, instead of node, for starting the program.
@wasdennnoch I’m pretty sure that discord-rpc
requires at least ES7 compatibility due to it using async-await
@liangchunn I'm using v7.9.0, the 7x versions already include async/await. I only needed the polyfill.
Downloading the newest 8.x.x Node.JS version did fix this problem for me!
@mrfizzl3 Please mark issues as closed/resolved if your issue has been fixed as part of GitHub's general etiquette