首页 > 解决方案 > (node:4) UnhandledPromiseRejectionWarning: Error: Incorrect login details were provided. (hosting a discord bot)

问题描述

when ever I run my bot I get the error bellow Ik the token is valid and it worked on glitch fine

my bot code: https://github.com/legouju/funtimesbottrytwo/tree/master (srry if im bothering u guys, im new to heroku)

what the logs says:

2018-11-08T01:02:06.643169+00:00 app[worker.1]: at _receiver.cleanup (/app/node_modules/ws/lib/websocket.js:220:12) 2018-11-08T01:02:06.643170+00:00 app[worker.1]: at Receiver.cleanup (/app/node_modules/ws/lib/receiver.js:535:15) 2018-11-08T01:02:06.643172+00:00 app[worker.1]: at WebSocket.finalize (/app/node_modules/ws/lib/websocket.js:206:20) 2018-11-08T01:02:06.643173+00:00 app[worker.1]: at TLSSocket.emit (events.js:187:15) 2018-11-08T01:02:06.643339+00:00 app[worker.1]: (node:4) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) 2018-11-08T01:02:06.644702+00:00 app[worker.1]: (node:4) [DEP0018] 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. 2018-11-08T01:02:06.806551+00:00 heroku[worker.1]: State changed from up to crashed 2018-11-08T01:09:10.724894+00:00 heroku[worker.1]: State changed from crashed to down 2018-11-08T01:09:10.613680+00:00 app[api]: Scaled to web@0:Free worker@0:Free by user johnmo123jm@gmail.com 2018-11-08T01:09:12.333365+00:00 app[api]: Scaled to web@0:Free worker@1:Free by user johnmo123jm@gmail.com 2018-11-08T01:09:15.179891+00:00 heroku[worker.1]: Starting process with command node index.js 2018-11-08T01:09:15.924170+00:00 heroku[worker.1]: State changed from starting to up 2018-11-08T01:09:17.897595+00:00 app[worker.1]: (node:4) UnhandledPromiseRejectionWarning: Error: Incorrect login details were provided. 2018-11-08T01:09:17.897616+00:00 app[worker.1]: at WebSocketConnection.client.ws.connection.once.event (/app/node_modules/discord.js/src/client/ClientManager.js:48:41) 2018-11-08T01:09:17.897618+00:00 app[worker.1]: at Object.onceWrapper (events.js:273:13) 2018-11-08T01:09:17.897620+00:00 app[worker.1]: at WebSocketConnection.emit (events.js:182:13) 2018-11-08T01:09:17.897621+00:00 app[worker.1]: at WebSocketConnection.onClose (/app/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:390:10) 2018-11-08T01:09:17.897623+00:00 app[worker.1]: at WebSocket.onClose (/app/node_modules/ws/lib/event-target.js:124:16) 2018-11-08T01:09:17.897624+00:00 app[worker.1]: at WebSocket.emit (events.js:182:13) 2018-11-08T01:09:17.897626+00:00 app[worker.1]: at _receiver.cleanup (/app/node_modules/ws/lib/websocket.js:220:12) 2018-11-08T01:09:17.897628+00:00 app[worker.1]: at Receiver.cleanup (/app/node_modules/ws/lib/receiver.js:535:15) 2018-11-08T01:09:17.897629+00:00 app[worker.1]: at WebSocket.finalize (/app/node_modules/ws/lib/websocket.js:206:20) 2018-11-08T01:09:17.897631+00:00 app[worker.1]: at TLSSocket.emit (events.js:187:15) 2018-11-08T01:09:17.897691+00:00 app[worker.1]: (node:4) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) 2018-11-08T01:09:17.897804+00:00 app[worker.1]: (node:4) [DEP0018] 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. 2018-11-08T01:09:17.991004+00:00 heroku[worker.1]: State changed from up to crashed 2018-11-08T01:09:17.993376+00:00 heroku[worker.1]: State changed from crashed to starting 2018-11-08T01:09:17.957224+00:00 heroku[worker.1]: Process exited with status 0 2018-11-08T01:09:20.088995+00:00 heroku[worker.1]: Starting process with command node index.js 2018-11-08T01:09:20.790067+00:00 heroku[worker.1]: State changed from starting to up 2018-11-08T01:09:23.458015+00:00 heroku[worker.1]: Process exited with status 0 2018-11-08T01:09:23.386529+00:00 app[worker.1]: (node:4) UnhandledPromiseRejectionWarning: Error: Incorrect login details were provided. 2018-11-08T01:09:23.386549+00:00 app[worker.1]: at WebSocketConnection.client.ws.connection.once.event (/app/node_modules/discord.js/src/client/ClientManager.js:48:41) 2018-11-08T01:09:23.386550+00:00 app[worker.1]: at Object.onceWrapper (events.js:273:13) 2018-11-08T01:09:23.386552+00:00 app[worker.1]: at WebSocketConnection.emit (events.js:182:13) 2018-11-08T01:09:23.386553+00:00 app[worker.1]: at WebSocketConnection.onClose (/app/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:390:10) 2018-11-08T01:09:23.386554+00:00 app[worker.1]: at WebSocket.onClose (/app/node_modules/ws/lib/event-target.js:124:16) 2018-11-08T01:09:23.386555+00:00 app[worker.1]: at WebSocket.emit (events.js:182:13) 2018-11-08T01:09:23.386556+00:00 app[worker.1]: at _receiver.cleanup (/app/node_modules/ws/lib/websocket.js:220:12) 2018-11-08T01:09:23.386557+00:00 app[worker.1]: at Receiver.cleanup (/app/node_modules/ws/lib/receiver.js:535:15) 2018-11-08T01:09:23.386558+00:00 app[worker.1]: at WebSocket.finalize (/app/node_modules/ws/lib/websocket.js:206:20) 2018-11-08T01:09:23.386560+00:00 app[worker.1]: at TLSSocket.emit (events.js:187:15) 2018-11-08T01:09:23.386689+00:00 app[worker.1]: (node:4) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2) 2018-11-08T01:09:23.386844+00:00 app[worker.1]: (node:4) [DEP0018] 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. 2018-11-08T01:09:23.570331+00:00 heroku[worker.1]: State changed from up to crashed

标签: heroku

解决方案


It looks like the error message is trying to tell you the following:

UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error 
originated either by throwing inside of an async function without a catch 
block, or by rejecting a promise which was not handled with .catch().

This is an error to do with your code. Also there is another error you should take a look at:

08T01:09:17.897595+00:00 app[worker.1]: (node:4) 
UnhandledPromiseRejectionWarning: Error: Incorrect login details were 
provided. 2018-11-08T01:09:17.897616+00:00 app[worker.1]: at 
WebSocketConnection.client.ws.connection.once.event 

Seems like there were incorrect credentials, review your code and see if your db authorizations are correct ect


推荐阅读