Skip to content

Object not found for update when setting badge in parse.push.send #3036

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

Closed
deveristica opened this issue Nov 11, 2016 · 1 comment
Closed

Comments

@deveristica
Copy link

deveristica commented Nov 11, 2016

When I'm trying to send a push notification with the badge property set to a number or 'Icrement', I always get the "Object not found for update" error. When I remove the badge property, everything works just fine.

!!! This only happens when I get the Installation Query through 'matchesKeyInQuery'.

When I get the installation query directly (.equalTo('objectId','xxxxxxx')) everything works just fine!

Steps to reproduce

var installationQuery = new Parse.Query(Parse.Installation);
var userQuery = new Parse.Query(Parse.User);
userQuery.equalTo('objectId', 'myUserId')
installationQuery.matchesKeyInQuery('objectId', 'installationId', userQuery);

Parse.Push.send({
where: installationQuery,
data: {
alert: 'Hi',
badge: 5,
sound: "default"
}
}, {
useMasterKey: true,
success: function () {
// Push was successful
response.success(usr.id);
},
error: function (error) {
// Handle error
console.log(error);
response.success(error);
}
});

Environment Setup

  • Server

    • parse-server version (Be specific! Don't say 'latest'.) : 2.2.24
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): Heroku
  • Database

    • MongoDB version: 3.0.12
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): mLab

Logs/Trace

2016-11-11T04:56:39.326000+00:00 heroku[router]: at=info method=POST path="/parse/push" host=fimp.herokuapp.com request_id=925290c2-0827-46ca-a157-0aaf3adce04c fwd="91.230.107.3" dyno=web.1 connect=0ms service=57ms status=200 bytes=533
2016-11-11T04:56:39.264825+00:00 app[web.1]: verbose: REQUEST for [POST] /parse/push: {
2016-11-11T04:56:39.264836+00:00 app[web.1]: "where": {
2016-11-11T04:56:39.264838+00:00 app[web.1]: "objectId": {
2016-11-11T04:56:39.264839+00:00 app[web.1]: "$select": {
2016-11-11T04:56:39.264840+00:00 app[web.1]: "key": "installationId",
2016-11-11T04:56:39.264841+00:00 app[web.1]: "query": {
2016-11-11T04:56:39.264842+00:00 app[web.1]: "where": {
2016-11-11T04:56:39.264842+00:00 app[web.1]: "objectId": "BwupyyH1Gq"
2016-11-11T04:56:39.264843+00:00 app[web.1]: },
2016-11-11T04:56:39.264844+00:00 app[web.1]: "className": "_User"
2016-11-11T04:56:39.264845+00:00 app[web.1]: }
2016-11-11T04:56:39.264845+00:00 app[web.1]: }
2016-11-11T04:56:39.264846+00:00 app[web.1]: }
2016-11-11T04:56:39.264846+00:00 app[web.1]: },
2016-11-11T04:56:39.264847+00:00 app[web.1]: "data": {
2016-11-11T04:56:39.264848+00:00 app[web.1]: "alert": "Hi",
2016-11-11T04:56:39.264848+00:00 app[web.1]: "badge": 5,
2016-11-11T04:56:39.264849+00:00 app[web.1]: "sound": "default"
2016-11-11T04:56:39.264849+00:00 app[web.1]: }
2016-11-11T04:56:39.264860+00:00 app[web.1]: } method=POST, url=/parse/push, host=fimp.herokuapp.com, connection=close, user-agent=node-XMLHttpRequest, Parse/js1.8.5 (NodeJS 4.4.5), accept=/, content-type=text/plain, x-request-id=925290c2-0827-46ca-a157-0aaf3adce04c, x-forwarded-for=91.230.107.3, x-forwarded-proto=http, x-forwarded-port=80, via=1.1 vegur, connect-time=0, x-request-start=1478840199267, total-route-time=0, content-length=373, key=installationId, objectId=BwupyyH1Gq, className=_User, alert=Hi, badge=5, sound=default
2016-11-11T04:56:39.295384+00:00 app[web.1]: verbose: RESPONSE from [POST] /parse/push: {
2016-11-11T04:56:39.295387+00:00 app[web.1]: "headers": {
2016-11-11T04:56:39.295388+00:00 app[web.1]: "X-Parse-Push-Status-Id": "fnMCrDfLVA"
2016-11-11T04:56:39.295388+00:00 app[web.1]: },
2016-11-11T04:56:39.295389+00:00 app[web.1]: "response": {
2016-11-11T04:56:39.295390+00:00 app[web.1]: "result": true
2016-11-11T04:56:39.295390+00:00 app[web.1]: }
2016-11-11T04:56:39.295391+00:00 app[web.1]: } X-Parse-Push-Status-Id=fnMCrDfLVA, result=true
2016-11-11T04:56:39.315141+00:00 app[web.1]: info: warning: error while sending push code=101, message=Object not found for update.

@flovilmart
Copy link
Contributor

I managed to repro the problem through an Unit test that will be part of the next update.

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