Skip to content

Unhandled Rejection when adding deviceToken to Installation #3758

@kahoona77

Description

@kahoona77

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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions