NPM UnhandledPromiseRejectionWarning [closed] - mongodb

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I've set up a 20.04 Ubuntu server in a virtual machine and on AWS to run an uno bot that is no longer hosted by the developer. (https://github.com/Exium1/UnoBot) I've been following someone's guide on how to set it up (https://github.com/DaanWet/UnoBot/blob/master/documentation/Install.md) but it is failing when i go to start it.
I get the following error:
(node:14998) UnhandledPromiseRejectionWarning: DiscordHTTPError: 401 Unauthorized on GET /api/v9/gateway/bot
at RequestHandler.request (/home/ubuntu/UnoBot/node_modules/eris-sharder/node_modules/eris/lib/rest/RequestHandler.js:75:15)
at Client.getBotGateway (/home/ubuntu/UnoBot/node_modules/eris-sharder/node_modules/eris/lib/Client.js:2135:36)
at ClusterManager.calculateShards (/home/ubuntu/UnoBot/node_modules/eris-sharder/src/sharding/clustermanager.js:507:38)
at process.nextTick (/home/ubuntu/UnoBot/node_modules/eris-sharder/src/sharding/clustermanager.js:179:41)
at process._tickCallback (internal/process/next_tick.js:61:11)
at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
(node:14998) 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:14998) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js pro
cess with a non-zero exit code.
could anyone help with resolving this issue?

In order to address the UnhandledPromiseRejectionWarning warning that was logged, you can fix it by adding the following to your code:
process.on("unhandledRejection", console.error);
This will log the error much more clearly, and will prevent your console from being filled up with those warnings.
As for what #mmenschig said, they are indeed correct. Ensure that you have the correct token passed into <Client>.login().

Related

How do I fix this error when creating a candy machine with metaplex?

I am following this tutorial "https://www.youtube.com/watch?v=4LLx7SMAOag&t=446s" and at 9:28 he tells us to input this
ts-node js/packages/cli/src/candy-machine-cli.ts upload ./assets --env devnet --keypair ~/config/solana/devnet-test.json
His result is an initialized candy machine as shown in the video. Mine is the following:
Beginning the upload for 150 (png+json) pairs
started at: 1634300753134
wallet public key: GLCNNSs9QA1YqxkY6Ptq3pb6UZrkRbwGw7ZUGeJK1CCg
(node:6434) UnhandledPromiseRejectionWarning: Error: failed to get info about
account 63N3bBDCVVzdCaofQAnY5s4kcZodw1evomptDgNQ4feK: FetchError: request to https://api.devnet.solana.com/ failed, reason: connect ENETUNREACH 128.0.113.156:443
at Connection.getAccountInfo (/Users/hectorbardales/Desktop/metaplex/js/node_modules/#solana/web3.js/src/connection.ts:2404:13)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Function.fetchIdl
(/Users/hectorbardales/Desktop/metaplex/js/node_modules/#project-serum/anchor/src/program/index.ts:309:25)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:6434) 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:6434) [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.
What do I do to fix this? (I'm running this in visual studio code on a Mac)
Here's what I did for example
ts-node ./js/packages/cli/src/candy-machine-v2-cli.ts upload \
-e devnet \
-k ./js/cm.devnet.json \
-cp ./js/config.json \
-c temp \
./js/assets-pictures
I made sure the path was clear and direct to each file, make sure for -k its path is to the file created when you did your keygen.
If you haven't, perhaps try airdropping 10 SOLs into that wallet address listed above? But do 5 first, then 5 again.
I can't remember what error I got, but I did have issues with that line.
Command for airdropping Sol is simple. Solana Airdrop x (x is your SOL amount).
Idk, worth a shot.
ENETUNREACH is a connection-related error. Even if you are able to browse the web or do other things, the best option is to test again with a new internet connection.

Can not connect to MongoDB Atlas version 4.0

I can't connect to the last version of Atlas (4.0), but if using an older version it connects!
I got this message when trying to connect to version 4.0
(node:9920) UnhandledPromiseRejectionWarning: Error: queryTxt ETIMEOUT cluster0.zgdl9.mongodb.net
at QueryReqWrap.onresolve [as oncomplete] (dns.js:203:19)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:9920) 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:9920) [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.
Go the the Network Access on your Atlas Cluster and check if you whitelisted your IP. You can also whitelist all IPs with 0.0.0.0/0. I think by default no IP is whitelisted and that is why you can't connect.

Strapi Start Install Issue on Mac

Having an issue installing Strapi on my Mac. Not sure what is going on really. Tried running npm install strapi-hook-strapi-mongoose and ran into 404 Not Found: strapi-hook-strapi-mongoose#latest.
USERs-MacBook-Pro:DIRECTORY USER$ strapi start
[2018-08-08T04:22:21.087Z] warn (hook:strapi-mongoose) `strapi-hook-strapi-mongoose` is missing in your dependencies. Please run `npm install strapi-hook-strapi-mongoose`
(node:42355) UnhandledPromiseRejectionWarning: TypeError: strapi.models.core_store.forge is not a function
at Object.get (/Users/USER/Documents/GitHub/DIRECTORY/node_modules/strapi/lib/core/store.js:55:47)
at module.exports (/Users/USER/Documents/GitHub/DIRECTORY/plugins/settings-manager/config/functions/bootstrap.js:17:26)
at Promise (/Users/USER/Documents/GitHub/DIRECTORY/node_modules/strapi/lib/Strapi.js:285:13)
at new Promise (<anonymous>)
at execBootstrap (/Users/USER/Documents/GitHub/DIRECTORY/node_modules/strapi/lib/Strapi.js:273:11)
at Promise.all.Object.values.map.x (/Users/USER/Documents/GitHub/DIRECTORY/node_modules/strapi/lib/Strapi.js:312:44)
at Array.map (<anonymous>)
at Strapi.bootstrap (/Users/USER/Documents/GitHub/DIRECTORY/node_modules/strapi/lib/Strapi.js:312:35)
at Strapi.start (/Users/USER/Documents/GitHub/DIRECTORY/node_modules/strapi/lib/Strapi.js:107:18)
(node:42355) 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: 3)
(node:42355) [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:42355) UnhandledPromiseRejectionWarning: TypeError: strapi.models.core_store.forge is not a function
at Object.get (/Users/USER/Documents/GitHub/DIRECTORY/node_modules/strapi/lib/core/store.js:55:47)
at module.exports (/Users/USER/Documents/GitHub/DIRECTORY/plugins/users-permissions/config/functions/bootstrap.js:77:45)
at Promise (/Users/USER/Documents/GitHub/DIRECTORY/node_modules/strapi/lib/Strapi.js:285:13)
at new Promise (<anonymous>)
at execBootstrap (/Users/USER/Documents/GitHub/DIRECTORY/node_modules/strapi/lib/Strapi.js:273:11)
at Promise.all.Object.values.map.x (/Users/USER/Documents/GitHub/DIRECTORY/node_modules/strapi/lib/Strapi.js:312:44)
at Array.map (<anonymous>)
at Strapi.bootstrap (/Users/USER/Documents/GitHub/DIRECTORY/node_modules/strapi/lib/Strapi.js:312:35)
at Strapi.start (/Users/USER/Documents/GitHub/DIRECTORY/node_modules/strapi/lib/Strapi.js:107:18)
(node:42355) 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: 4)
(node:42355) UnhandledPromiseRejectionWarning: ReferenceError: config is not defined
at fs.readdir (/Users/USER/Documents/GitHub/DIRECTORY/plugins/email/config/functions/bootstrap.js:53:40)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:42355) 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: 6)
(node:42355) UnhandledPromiseRejectionWarning: ReferenceError: config is not defined
at fs.readdir (/Users/USER/Documents/GitHub/DIRECTORY/plugins/upload/config/functions/bootstrap.js:55:40)
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:42355) 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: 8)
[2018-08-08T04:22:25.197Z] info File changed: /Users/USER/Documents/GitHub/DIRECTORY/plugins/graphql/config/generated/schema.graphql
[2018-08-08T04:22:25.364Z] warn Bootstrap is taking unusually long to execute its callback 3500 miliseconds).
[2018-08-08T04:22:25.364Z] warn Perhaps you forgot to call it?
[2018-08-08T04:22:25.364Z] warn Bootstrap is taking unusually long to execute its callback 3500 miliseconds).
[2018-08-08T04:22:25.364Z] warn Perhaps you forgot to call it?
[2018-08-08T04:22:25.366Z] warn Bootstrap is taking unusually long to execute its callback 3500 miliseconds).
[2018-08-08T04:22:25.366Z] warn Perhaps you forgot to call it?
[2018-08-08T04:22:25.366Z] warn Bootstrap is taking unusually long to execute its callback 3500 miliseconds).
[2018-08-08T04:22:25.366Z] warn Perhaps you forgot to call it?
Installation
npm install strapi#alpha -g
Installation Guide
For Strapi installation Guide, Click here
Turns out this is a common Mac bug, instead of using the 'strapi' command where I too got that error, I created my project using yarn and I was able to get past it.
yarn create strapi-app new-project-name

Ionic 2: UnhandledPromiseRejectionWarning: Error: The platform "andorid" does not appear to have been added to this project

Got the following error while running the porject:
(node:5692) UnhandledPromiseRejectionWarning: Error: The platform "andorid" does not appear to have been added to this project.
at Object.getPlatformApi (C:\Users\sivaramakrishnan.m\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\platforms\platforms.js:46:15)
at C:\Users\sivaramakrishnan.m\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\prepare.js:54:38
at Array.map (<anonymous>)
at C:\Users\sivaramakrishnan.m\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\prepare.js:52:47
at _fulfilled (C:\Users\sivaramakrishnan.m\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:787:54)
at self.promiseDispatch.done (C:\Users\sivaramakrishnan.m\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:816:30)
at Promise.promise.promiseDispatch (C:\Users\sivaramakrishnan.m\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:749:13)
at C:\Users\sivaramakrishnan.m\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:557:44
at flush (C:\Users\sivaramakrishnan.m\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\q\q.js:108:17)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
(node:5692) 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:5692) [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.
[OK] Your app has been deployed.
Did you know you can live-reload changes from your app with --livereload?
It looks like you have a typo in the platform: "andorid" instead of "android"
Have you checked the command that you use to build?

fatal error : 'couldn't connect to host' ! (Facebook API) [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I'm trying to add Facebook API on my web application..
But when I tried to post links using the Graph API.. I got this error:
Fatal error: Uncaught exception 'Facebook\FacebookSDKException' with
message 'couldn't connect to host' in
/home/u614270703/public_html/test/vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookCurlHttpClient.php:156
Stack trace: #0
/home/u614270703/public_html/test/vendor/facebook/php-sdk-v4/src/Facebook/FacebookRequest.php(248):
Facebook\HttpClients\FacebookCurlHttpClient->send('https://graph.f...',
'POST', Array) #1 /home/u614270703/public_html/test/session2.php(32):
Facebook\FacebookRequest->execute() #2 {main} thrown in
/home/u614270703/public_html/test/vendor/facebook/php-sdk-v4/src/Facebook/HttpClients/FacebookCurlHttpClient.php
on line 156
I don't have any idea what is going on. What does this error means? I don't know why I can't 'connect to host'.
Your server probably blocks outgoing CURL requests, contact your provider and ask him if he could open access to the Facebook API server (graph.facebook.com).
There are other threads about this too:
Fatal error: Uncaught CurlException: 7: couldn't connect to host thrown in ....src/base_facebook.php on line 887
How to resolve cURL Error (7): couldn't connect to host?
https://stackoverflow.com/questions/9425406/facebook-api-exception-object-error-on-facebook-app