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!
Can Watson Visual Recognition be trained on human faces now? 2 Answers
Watson Visual Recognition Face Detection not recognising celebrities as they used to be. 1 Answer
How does watson discovery do retrive and ranking? 2 Answers
How to create a simple Hello World IBM Bluemix node.js application in Eclipse and run in eclipse. 3 Answers
Data transfer between Oracle and Bluemix through NodeJS 1 Answer