Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled Rejection when adding deviceToken to Installation #3758

Closed
kahoona77 opened this issue Apr 26, 2017 · 4 comments
Closed

Unhandled Rejection when adding deviceToken to Installation #3758

kahoona77 opened this issue Apr 26, 2017 · 4 comments

Comments

@kahoona77
Copy link
Contributor

Issue Description

I have an an Problem with an unhandled rejection when adding a deviceToken to an Installation.

The problem is, that the code tries to delete an installation that might have this deviceToken and that is not equal to the objectID.
But when there is no other installation with this deviceToken then there is nothing to delete and the promise from (this.config.database.destroy('_Installation', delQuery); in RestWrite.js ) is rejected.
This leads to an unhandledRejection Error in node, which is polluding the logs.

Is there a way to avoid this? Or could this rejection be handled?

Thanks in advance!

Steps to reproduce

Add a new deviceToken to an Installation. For instance:

PUT http://.../api/classes/_Installation/b8otEVPJCw
{
"pushType": "gcm",
"deviceToken": "fdsf-TGlr5czq5y7PFdRUcxxycmMm5kD0u1AyKxYrL2t4fmcobWFJyqXRe4KlXikr9UP2a8ijsnpkNhuPXXvZbiC4B3tQYzTfFht8sFAgkfyZkZFlUnPFVg6jaaDVJsVeGQkxZi703A",
"objectId": "b8otEVPJCw"
}

Expected Results

The Installation is updated and no error is logged.

Actual Outcome

The Installation is updated, but an error is logged:

You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
[object Object]

The error is actually: code=101, message=Object not found.

Environment Setup

  • Server
    • parse-server version : 2.3.8
    • Operating System: ubuntu-sever 14.04
    • Localhost or remote server: AWS

Logs/Trace

You have triggered an unhandledRejection, you may have forgotten to catch a Promise rejection:
[object Object]
@flovilmart
Copy link
Contributor

Unhandled rejection would log only on nodejs 6.9+, we need to update the code for those. A PR is welcome :)

@kahoona77
Copy link
Contributor Author

Thanks, for the quick response. I will be looking into creating an PR in the coming days.

@flovilmart
Copy link
Contributor

Awesome! Thanks!

@kahoona77
Copy link
Contributor Author

Hi,
I just submitted an PR (#3795) for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants