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

Push badge update to multiple object ids does not work #2903

Closed
4 tasks done
crazyscorpio12 opened this issue Oct 21, 2016 · 12 comments
Closed
4 tasks done

Push badge update to multiple object ids does not work #2903

crazyscorpio12 opened this issue Oct 21, 2016 · 12 comments

Comments

@crazyscorpio12
Copy link

Please read the following instructions carefully.

Check out #1271 for an ideal bug report.
The closer your issue report is to that one, the more likely we are to be able to help, and the more likely we will be to fix the issue quickly!

Many members of the community use Stack Overflow and Server Fault to ask questions.
Read through the existing questions or ask your own!

For database migration help, please file a bug report at https://parse.com/help#report

Make sure these boxes are checked before submitting your issue -- thanks for reporting issues back to Parse Server!

Issue Description

Sending a badge update to selected object ids for ios does not work using parse v2.2.23

The following request works and the badge update is sent.

variable declarations:
url = 'https://ourdomain.com/parse/push'
parse_headers={
     'X-Parse-REST-API-Key': 'OUR_API_KEY', 
     'X-Parse-Application-Id': 'OUR_APP_ID', 
     'X-Parse-Master-Key': 'OUR_MASTER_KEY',
     'content-type': 'application/json'
}

response = requests.post(
     url, 
     headers=parse_headers, 
     data='{"data":{"badge":"Increment"}, "where": {"deviceType": "ios", "objectId": "SOMEOBJECTID"}}'
)

but, this (adding the '$in' condition) does not work:

response = requests.post(
     url,
     headers=parse_headers,
     data='{"data":{"badge":"Increment"}, "where": {"deviceType": "ios", "objectId": {"$in": ["SOMEOBJECTID", "SOMEOTHEROBJECTID"]}}}'
)

parse logs show the following error

info: warning: error while sending push code=101, message=Object not found for update.

And If I use hosted parse.com API instead of our own hosted parse, the above request works without any issue.

Expected Results

response.content = '{"result":true}'

Badge update should be sent
Parse dashboard shows status as success

Actual Outcome

response.content = '{"result":true}'

Badge update is not sent.
Parse dashboard shows status as failed

Environment Setup

  • Server
    • parse-server version (Be specific! Don't say 'latest'.) : v2.2.23
    • Operating System: ubuntu
    • Hardware: AWS EC2 small instance
    • Localhost or remote server? (AWS, Heroku, Azure, Digital Ocean, etc): AWS
  • Database
    • MongoDB version: 3.0
    • Storage engine: [FILL THIS OUT]
    • Hardware: [FILL THIS OUT]
    • Localhost or remote server? (AWS, mLab, ObjectRocket, Digital Ocean, etc): compose

Logs/Trace

verbose: REQUEST for [POST] /parse/push: {
   "data": {
     "badge": "Increment"
   },
   "where": {
     "objectId": {
       "$in": [
         "REMOVED"
       ]
     },
     "deviceType": "ios"
   }
 } method=POST, url=/parse/push, host=127.0.0.1:1337, connection=close, content-length=101, x-parse-application-id=REMOVED, accept=*/*, content-type=application/json, user-agent=python-requests/2.7.0 CPython/2.7.10 Linux/3.13.0-100-generic, x-parse-rest-api-key=REMOVED, x-parse-master-key=REMOVED, accept-encoding=gzip, deflate, badge=Increment, $in=[REMOVED], deviceType=ios
 verbose: RESPONSE from [POST] /parse/push: {
   "headers": {
     "X-Parse-Push-Status-Id": "REMOVED"
   },
   "response": {
     "result": true
   }
 } X-Parse-Push-Status-Id=REMOVED, result=true
 info: warning: error while sending push code=101, message=Object not found for update.
@kwstasna
Copy link

kwstasna commented Oct 21, 2016

https://github.com/ParsePlatform/parse-server/wiki/Push#api

Here is the list of sending options we do not support yet:

  • push_time for scheduled push
  • Increment badge under data for iOS badge number

@flovilmart
Copy link
Contributor

the increment should work correctly, it seems that there is an error while trying to update the installations that you're targeting. Are the objectId all present in the database?

@josjevv
Copy link

josjevv commented Oct 28, 2016

I tested sending mesages using Curl with an objectId present in the database. I still get the 101 message as mentioned above in the logs on parse-server. Sending the same message using parse.com api (which is connected to same db) does work. So It seems that badge updates indeed don't work yet as mentioned on parse-server wiki.

@flovilmart
Copy link
Contributor

I'm not sure if related to the badge update or something else. If you put a 'static' badge value, or no badge value, what's the outcome (with the same where clause)

@josjevv
Copy link

josjevv commented Oct 28, 2016

Hi, it's probably somethings else. If I put e.g. 10 in that, it also does not work on parse-server (but does on parse.com).

@flovilmart
Copy link
Contributor

So that goes back to my question: Are the objectId all present in the database?

@josjevv
Copy link

josjevv commented Oct 28, 2016

yes. The test message I used only sends to one device which does exist in the db. The batch updates do work using parse.com on that device.

@flovilmart
Copy link
Contributor

what's the curl method/ logs,
because what I see is that the original query implies an $in operator.

@josjevv
Copy link

josjevv commented Oct 31, 2016

Hi, thanks for helping out here.

Post data (push-increment.json):

{
   "data": {
     "badge": 11
   },
   "where": {
     "objectId": {
       "$in": [
         "REMOVED"
       ]
     },
     "deviceType": "ios"
   }
}

The ObjectId does exist in the database. For testing purposes, I only use one device now.

The curl command:

curl -X POST -d @push-increment.json -H "Content-Type: application/json" -H "X-Parse-Application-Id: REMOVED" -H "X-Parse-Master-Key: REMOVED" https://api.parse.com/1/push 

this works using parse.com, but if I do the same with our own parse server:

curl -X POST -d @push-increment.json -H "Content-Type: application/json" -H "X-Parse-Application-Id: REMOVED" -H "X-Parse-Master-Key: REMOVED" https://parse-server-REMOVED/parse/push 

It also claims {"result":true}, however the badge has not been updated. If I look at the logs on the server, I get the error as mentioned before:

parse-server-staging-4 (out):     "badge": 11
parse-server-staging-4 (out):   },
parse-server-staging-4 (out):   "where": {
parse-server-staging-4 (out):     "objectId": {
parse-server-staging-4 (out):       "$in": [
parse-server-staging-4 (out):         "REMOVED"
parse-server-staging-4 (out):       ]
parse-server-staging-4 (out):     },
parse-server-staging-4 (out):     "deviceType": "ios"
parse-server-staging-4 (out):   }
parse-server-staging-4 (out): } method=POST, url=/parse/push, host=127.0.0.1:1337, connection=close, content-length=145, user-agent=curl/7.43.0, accept=*/*, content-type=application/json, x-parse-application-id=REMOVED, x-parse-master-key=REMOVED, badge=11, $in=[REMOVED], deviceType=ios
parse-server-staging-4 (out): verbose: RESPONSE from [POST] /parse/push: {
parse-server-staging-4 (out):   "headers": {
parse-server-staging-4 (out):     "X-Parse-Push-Status-Id": "REMOVED"
parse-server-staging-4 (out):   },
parse-server-staging-4 (out):   "response": {
parse-server-staging-4 (out):     "result": true
parse-server-staging-4 (out):   }
parse-server-staging-4 (out): } X-Parse-Push-Status-Id=REMOVED, result=true
parse-server-staging-4 (out): info: warning: error while sending push code=101, message=Object not found for update.

@josjevv
Copy link

josjevv commented Oct 31, 2016

one more thing, I noticed in the release notes of parse-server v2.2.3 that node >= 4.5. I upgraded to v6.9.1 (LTS) (we were running node 4.4.7) and still facing the same error.

@josjevv
Copy link

josjevv commented Nov 11, 2016

@flovilmart can you please help out? I provided all information that you requested.

@flovilmart
Copy link
Contributor

It will be fixed in next release

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

4 participants