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

problem with json push #1581

Closed
3 tasks done
mustafauysal opened this issue Apr 21, 2016 · 10 comments
Closed
3 tasks done

problem with json push #1581

mustafauysal opened this issue Apr 21, 2016 · 10 comments

Comments

@mustafauysal
Copy link

mustafauysal commented Apr 21, 2016

Check out this issue 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!

For implementation related questions or technical support, please refer to the Stack Overflow and Server Fault communities.

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

Environment Setup

Ubuntu 14.04
node v5.10.1
npm 3.8.3
mongod 3.0.11
parse-server 2.2.7
parse-dashboard 1.0.9

Steps to reproduce

I can't send json messages via parse dashboard. I've checked http response and it seems {result: true} but can't push message anyway. (no problem with text messages)

I didn't get any error with curl and json messages delivering smoothly.

@drew-gross told this might be a parse-server issue.

Thanks,

Logs/Trace

error: error while sending push code=101, message=Object not found.

@yz
Copy link

yz commented Apr 22, 2016

I have the similar issue, can't get the cloud code push notification to work. Using CURL works fine. but sending from cloud code getting:
Failed to load resource: the server responded with a status of 400 (Bad Request)

@flovilmart
Copy link
Contributor

can you run the server with VERBOSE=1 and give us the logs attached to it?

@mustafauysal
Copy link
Author

Ok, I realized the problem. The problem is, json message itself sending as an alert.

When I send the json message below

{ 
  "alert": "Yeni Tarif Eklendi Fotosuz", 
  "isJSONPush": "true", 
  "post_id": 845637, 
  "post_title": "Tencerede Kakaolu Sünger Kek Tarifi", 
  "push_type": "post", 
  "title": "Nefis Yemek Tarifleri" 
}

LOG:

 "where": {
    "userId": "871923",
    "deviceType": {
      "$in": [
        "android"
      ]
    }
  },
  "data": {
    "alert": {
      "alert": "Yeni Tarif Eklendi Fotosuz",
      "isJSONPush": "true",
      "post_id": 845637,
      "post_title": "Tencerede Kakaolu Sünger Kek Tarifi",
      "push_type": "post",
      "title": "Nefis Yemek Tarifleri"
    }
  }
}
verbose: {
  "headers": {
    "X-Parse-Push-Status-Id": "IsfuMjTHHr"
  },
  "response": {
    "result": true
  }
}

@flovilmart
Copy link
Contributor

I'll have a look, @drew-gross isn't it a dashboard problem? The JSON should not be embedded no?

@drew-gross
Copy link
Contributor

The dashboard uses the JS SDK, just calls Parse.Push.send()

@flovilmart
Copy link
Contributor

yeah I know, but the data is nested in the alert key. instead of set as the data object

@drew-gross
Copy link
Contributor

Is this not right?

@flovilmart
Copy link
Contributor

flovilmart commented Apr 22, 2016

in that case: that should be:

let payload = changes.data_type === 'json' ? JSON.parse(changes.data) : {alert: changes.data};

that will prevent the double embedding:

"data": {
    "alert": {
      "alert": "Yeni Tarif Eklendi Fotosuz",
      "isJSONPush": "true",
      "post_id": 845637,
      "post_title": "Tencerede Kakaolu Sünger Kek Tarifi",
      "push_type": "post",
      "title": "Nefis Yemek Tarifleri"
    }
  }

to:

"data": {
      "alert": "Yeni Tarif Eklendi Fotosuz",
      "isJSONPush": "true",
      "post_id": 845637,
      "post_title": "Tencerede Kakaolu Sünger Kek Tarifi",
      "push_type": "post",
      "title": "Nefis Yemek Tarifleri"
 }

@drew-gross
Copy link
Contributor

Sounds good

@mustafauysal
Copy link
Author

This issue fixed with latest dashboard update. Thanks fellas!

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