Skip to content
This repository was archived by the owner on Mar 22, 2022. It is now read-only.

Unhandled Promise Rejection error. #489

Closed
blopez2010 opened this issue Apr 23, 2017 · 4 comments
Closed

Unhandled Promise Rejection error. #489

blopez2010 opened this issue Apr 23, 2017 · 4 comments

Comments

@blopez2010
Copy link

Hello,

I'm supporting a React Native app with a backend written in an older feathers and feathers authentication version. I can not upgrade it because it will cause a big impact on the backend and frontend software version and I can not do that because I could take days to make both products work as expected.

When I deliver the first app version I've been getting the following error:

unhandled_promise_rejection

The most weird thing is This only happens on first app login, later on it won't happen again

I've been circle around the app and there is no reason this error is being thrown, since I've commented all console.log commands on the code. Yesterday I read this post by @ekryski No auth token but the proposed fix could not be done since it is in a newer version.

What can I do in this case?

Thanks for any help

This is the backend package list:
{
"dependencies": {
"aws-sdk": "^2.7.11",
"bcrypt": "^1.0.2",
"body-parser": "^1.15.2",
"compression": "^1.6.2",
"cors": "^2.8.1",
"dauria": "^1.1.5",
"feathers": "^2.0.2",
"feathers-authentication": "^0.7.12",
"feathers-blob": "^1.2.0",
"feathers-configuration": "^0.3.3",
"feathers-errors": "^2.5.0",
"feathers-hooks": "^1.7.0",
"feathers-rest": "^1.5.2",
"feathers-rethinkdb": "^0.3.2",
"feathers-sendgrid": "^0.2.1",
"feathers-socketio": "^1.4.2",
"feathers-stripe": "^0.3.0",
"fs-blob-store": "^5.2.1",
"hbs": "^4.0.1",
"json2csv": "^3.7.3",
"lodash": "^4.17.4",
"md5": "^2.2.1",
"multer": "^1.3.0",
"passport": "^0.3.2",
"rethinkdbdash": "^2.3.27",
"s3-blob-store": "^1.2.3",
"serve-favicon": "^2.3.2",
"uws": "^0.14.1",
"winston": "^2.3.0",
"xlsx": "^0.8.7"
},
"devDependencies": {
"csv-parse": "^1.1.7",
"feathers-socketio": "^1.4.2",
"jshint": "^2.9.4",
"lodash.concat": "^4.5.0",
"lodash.map": "^4.6.0",
"lodash.omit": "^4.5.0",
"mocha": "^3.2.0",
"node-fetch": "^1.6.3",
"password-generator": "^2.0.6",
"request": "^2.79.0",
"socket.io": "^1.7.2",
"yargs": "^6.5.0"
}
}

An this is the RN package list:

{
"dependencies": {
"color": "^1.0.2",
"feathers-authentication": "^0.7.12",
"feathers-reactive": "^0.4.1",
"lodash": "^4.17.2",
"native-base": "0.5.20",
"react": "~15.4.0-rc.4",
"react-native": "0.38.0",
"react-native-animated-steps": "^1.0.0",
"react-native-code-push": "^1.16.0-beta",
"react-native-cookies": "^2.0.0",
"react-native-credit-card-input": "^0.3.1",
"react-native-drawer": "^2.3.0",
"react-native-elements": "^0.7.0",
"react-native-fetch-blob": "^0.10.4",
"react-native-gifted-messenger": "^0.1.4",
"react-native-image-picker": "latest",
"react-native-image-resizer": "0.0.12",
"react-native-keyboard-spacer": "^0.3.0",
"react-native-permissions": "^0.2.5",
"react-native-router-flux": "^3.37.0",
"react-native-share-actions": "^0.1.0",
"react-native-vector-icons": "^3.0.0",
"react-native-youtube": "^0.8.0",
"rxjs": "^5.0.1",
"socket.io-client": "1.6.0"
},
"devDependencies": {
"babel-cli": "^6.18.0",
"babel-core": "^6.18.2",
"babel-eslint": "^7.1.1",
"babel-jest": "17.0.2",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-polyfill": "6.16.0",
"babel-preset-react-native": "^1.9.1",
"babel-preset-react-native-stage-0": "^1.0.1",
"feathers": "^2.0.2",
"feathers-authentication-client": "^0.1.6",
"feathers-client": "^1.7.2",
"feathers-hooks": "^1.6.1",
"feathers-socketio": "^1.4.2",
"immutable": "^3.8.1",
"immutable-devtools": "^0.0.7",
"jest": "17.0.3",
"jest-react-native": "17.0.3",
"proxyquire": "^1.7.10",
"react-native-debugger-open": "^0.3.0",
"react-native-mock": "^0.2.3",
"react-redux": "^4.4.6",
"react-test-renderer": "15.3.2",
"redux": "^3.6.0",
"redux-thunk": "^2.1.0",
"remote-redux-devtools": "^0.4.1",
"remote-redux-devtools-on-debugger": "^0.7.0"
}
}

Expected behavior

Install the app and don't see the error thrown.

Actual behavior

At first app installation, this error is being thrown having all console.log commands commented.

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):

NodeJS version: v6.9.4

Operating System: mac OS SIERRA v 10.12.4

React Native Version: react-native-cli: 2.0.1

@blopez2010
Copy link
Author

blopez2010 commented Apr 23, 2017

Actually, doing some tests, this error happens every time I started the app and doesn't have an token stored.

@marshallswain
Copy link
Member

@blopez2010 It seems like all you would need to do is add a catch block after app.authenticate:

app.authenticate().catch(error => {console.log(error)})

@blopez2010
Copy link
Author

Awesome!! Thanks a lot @marshallswain it worked!!, I really didn't wanted to ask this as an issue but I didn't found the answer in the documentation either. Thanks a lot and have a good day!

@marshallswain
Copy link
Member

Glad it worked. We don't have any aversion to answering questions in the GitHub issues. 😉

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants