Hello, Following Node JS code is returning unhandled promise rejection warning :
app.get(LOGIN_URL, passport.authenticate(WebAppStrategy.STRATEGY_NAME, { successRedirect: LANDING_PAGE_URL, forceLogin: true }));
Snippet from logs :
[2018-11-14 19:14:20.913] [DEBUG] appid-webapp-strategy - handleAuthorization [2018-11-14 19:14:20.918] [DEBUG] appid-webapp-strategy - handleAuthorization :: redirecting to https://appid-oauth.eu-gb.bluemix.net/oauth/v3/XXXXXXXXXXXXXXXXXXXXX/authorization?client_id=XXXXXXXXXXXXX&response_type=code&redirect_uri=http://localhost:3009/ibm/bluemix/appid/callback≻ope=appid_default⟨uage=en-US&state=XXXXXXXXXXXXX (node:15188) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): (node:15188) [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-14 19:14:40.698] [DEBUG] appid-webapp-strategy - handleCallback
Please help.
Thanks! Pushkar
Answer by NitzanNissim (1) | Nov 14, 2018 at 10:35 AM
Its hard to know from this where was the UnhandledPromiseRejectionWarning thrown from in your application. Can you please add this code:
process.on('unhandledRejection', (reason, p) => {
console.log('Unhandled Rejection at:', p, 'reason:', reason);
} );
this will let us know what is the origin of the promise, and whether its App ID related.
Hi,
Below is what i see after adding the above code :
[2018-11-14 22:00:31.031] [DEBUG] appid-webapp-strategy - handleAuthorization [2018-11-14 22:00:31.035] [DEBUG] appid-webapp-strategy - handleAuthorization :: redirecting to https://appid-oauth.eu-gb.bluemix.net/oauth/v3/XXXXXXXXXX/authorization?client_id=XXXXXXXXX&response_type=code&redirect_uri=http://localhost:3009/ibm/bluemix/appid/callback≻ope=appid_default⟨uage=en-US&state=XXXXXX Unhandled Rejection at: Promise { '' } reason:
Also, the promise rejection warning does not seem to be thrown from the application code but from some app id library because it is thrown even before redirection i.e. while loading the login page itself and there is no other code involved apart from the above app.get(LOGIN_URL)....
Thanks!
I want to answer based on compose-mysql database but don't know how to do.. 1 Answer
what are the credentials to log into rank and retrieve? 4 Answers
Where can I find my correct Alchemy API Key? 1 Answer
Can Watson Assistant detect multiple intents? 3 Answers
Error while installing watson-developer-cloud Node package. 0 Answers