On the console I'm getting an 'UnhandledPromiseRejectionWarning' - javascript

0-0] 2020-05-13T02:50:41.196Z ERROR webdriver: Request failed with status 404 due to invalid session id: invalid session id
[0-0] (node:80394) UnhandledPromiseRejectionWarning: invalid session id
at processTicksAndRejections (internal/process/task_queues.js:89:5)
at ElementUtil.doGetText (/Users/arjitrout/Downloads/BasicReport 3/test/util/elementUtil.js:13:20)
at ShopPage.getCategoryTitle (/Users/arjitrout/Downloads/BasicReport 3/test/pages/shop.page.js:13:27)
at World.<anonymous> (/Users/arjitrout/Downloads/BasicReport 3/test/stepDefination/shop/popularCategories.stepdefs.js:27:35)
[0-0] (node:80394) 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)
(node:80394) [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.
[0-0] FAILED in chrome - /test/features/shop/popularCategories.feature

Based on your error message, you have an issue with your session id. You may want to check this page to know more about it.
As for the Unhandled Promise error, Usually, this error is thrown when an exception occurs inside a Promise when you don't provide a catch clause and window.unhandledrejection is not defined, but I bet it's related to the invalid session id issue in this particular case. You can try to fix that first, then see if that solves both problems.

Related

Unable to get local issuer certificate in node js

I am new to the node js.I am getting this error while running my node js code in local. Please help me in this.
(node:7532) UnhandledPromiseRejectionWarning: Error: unable to get local issuer certificate
at TLSSocket.onConnectSecure (_tls_wrap.js:1048:34)
at TLSSocket.emit (events.js:182:13)
at TLSSocket._finishInit (_tls_wrap.js:628:8)
(node:7532) 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: 1)
(node:7532) [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.
I tried some of the available solution on the internet, but so far any of them are working.
This are the things I have tried.
npm set strict-ssl=false
npm config set strict-ssl false
export NODE_TLS_REJECT_UNAUTHORIZED=0

Discord.js Missing API PERMISSIONS [Preventing the node process from being terminated]

I have made an AFK command using Change Nickname. Whenever a user above the bot's role uses this command. I get the following error(node:169)
UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
at RequestHandler.execute (/home/runner/MutedPinkBlogclient/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:169) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:169) [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.
(node:169) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
at RequestHandler.execute (/home/runner/MutedPinkBlogclient/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:169) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
This later terminates the bots process. This further terminates the bots process. Is there any way to stop the node process from being terminated without increasing the role of the bot.
Here is my code for that command
client.on('message', message => {
if (message.content.includes('start-afk')) {
message.member.setNickname(`AFK | ${message.author.username}`);
}
if (message.content.includes('end-afk')) {
message.member.setNickname('');
}
});
Can you help me out?
Discord won't allow users/bot accounts to change someone's nickname if their role is higher than your bot's.
All you can do is catch the error and send an error message to the channel.
message.member.setNickname("Nickname").catch(error => message.channel.send("Couldn't update your nickname."));

How to fix 'Error: ENOENT' in node.js if the file and the requirement was deleted?

I recently changed the event handler dor my discord bot and I get this error.
I edited all the files so I don`t get any error but now I get this error and it does not say where the error takes place
(node:9356) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, scandir 'C:\Users\user1\Documents\GitHub\MYSQL_TEST\utils\events'
(node:9356) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:9356) [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.```

Discord Bot that check proxies gives a funny error

It keeps returning these errors. I've checked if it was my proxy API - but its not. I believe its an internal error. I've double checked and NPM installed all the dependencies. Still returns this error.
Again, all help is appreciated. Thanks for your time :3
(node:28544) UnhandledPromiseRejectionWarning: Error [INVALID_TYPE]: Supplied options is not an object.
at Message.delete (c::user/example/\Message.js:500:44)
at c:user/example/server.js:27:21
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:28544) 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: 1)
(node:28544) [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.
(node:28544) UnhandledPromiseRejectionWarning: Error [INVALID_TYPE]: Supplied options is not an object.
at Message.delete (c::user/example/\Message.js:500:44)
at c:\Users\aweso\Downloads\polarcop_discord-master\server.js:32:23
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:28544) 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)
Basing on stack trace you provided, you are passing invalid parameter to message.delete() method. On v12 it takes an object with timeout and/or reason keys, like shown in the documentation. For example, instead of delete(1000) you have to do delete({ timeout: 1000 })
Note however, that not everyone would be able to answer that question without providing more information, like code that gives you that error.

Unhandled promise rejection AVA

I want to use ava for test my code but when I try it I'm getting the following error... I think there is a catch (err) missing...
(node:7640) UnhandledPromiseRejectionWarning: C:\...\TesBoard-db\node_modules\ava\lib\node-arguments.js:9
} catch {
^
(node:7640) 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: 1)
(node:7640) [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.
Any idea how to resolve this...?
Thanks in advance.
Yes, update Node. <- They recommend Node.js 12.15 in that issue thread.
For future reference, as well as StackOverflow, you want to search the GitHub issues of whatever is throwing or misbehaving, when it is something in the stack.

Categories