Skip to content

query and payload fields in _PushStatus encoding are incorrect #8030

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
4 tasks done
cbaker6 opened this issue Jun 8, 2022 · 5 comments
Closed
4 tasks done

query and payload fields in _PushStatus encoding are incorrect #8030

cbaker6 opened this issue Jun 8, 2022 · 5 comments
Labels
type:question Support or code-level question

Comments

@cbaker6
Copy link
Contributor

cbaker6 commented Jun 8, 2022

New Issue Checklist

Issue Description

The query and payload fields in the _PushStatus class are sent to the clients doubly encoded, meaning they have to be decoded twice by any REST client.

Steps to reproduce

Send a push notification that would produce an error so the errorMessage field is populated

Fetch any object from the _PushStatus class after sending a push notification.

Actual Outcome

The query and payload fields have to first be decoded as a string, then that string has to be decoded to the proper object. It's possible the server is either storing this data as encoded or it's encoding these fields twice when sending to clients. See the extra escaping sent from the server:

{\"results\":[{\"objectId\":\"22ec5k0WvPQJQFqF5MHLa9Twn3k5AjRO\",\"createdAt\":\"2022-06-08T01:55:33.783Z\",\"updatedAt\":\"2022-06-08T01:55:33.816Z\",\"pushTime\":\"2022-06-08T01:55:33.783Z\",\"source\":\"rest\",\"query\":\"{\\\"objectId\\\":{\\\"$ne\\\":null}}\",\"payload\":\"{\\\"alert\\\":{\\\"body\\\":\\\"Hello from ParseSwift!\\\"},\\\"badge\\\":1}\",\"status\":\"succeeded\",\"numSent\":0,\"pushHash\":\"5064192be6a88ae013ae516b4601dc95\",\"ACL\":{}}]}

Expected Outcome

The objects in query and payload fields should be able to be decoded directly instead being decoded twice.

{\"results\":[{\"objectId\":\"22ec5k0WvPQJQFqF5MHLa9Twn3k5AjRO\",\"createdAt\":\"2022-06-08T01:55:33.783Z\",\"updatedAt\":\"2022-06-08T01:55:33.816Z\",\"pushTime\":\"2022-06-08T01:55:33.783Z\",\"source\":\"rest\",\"query\":\"{\"objectId\":{\"$ne\":null}}\",\"payload\":\"{\"alert\":{\"body\":\"Hello from ParseSwift!\"},\"badge\":1}\",\"status\":\"succeeded\",\"numSent\":0,\"pushHash\":\"5064192be6a88ae013ae516b4601dc95\",\"ACL\":{}}]}

Environment

Server

  • Parse Server version: 5.2.0
  • Operating system: Linux/docker
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): local

Database

  • System (MongoDB or Postgres): Postgres
  • Database version: 14
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): local

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): Swift SDK
  • SDK version: 4.5.0

Logs

@parse-github-assistant
Copy link

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

@mtrezza
Copy link
Member

mtrezza commented Jun 8, 2022

It looks like an inconvenience, but probably not a bug, as no functionality seems to be impaired. I also suggest to take a look at the git blame to see whether there was a rationale for this.

@mtrezza mtrezza added the type:feature New feature or improvement of existing feature label Jun 8, 2022
@cbaker6
Copy link
Contributor Author

cbaker6 commented Jun 16, 2022

Seems like current way might be correct because of $ and the requirements to send localized notifications: #2397

@mtrezza
Copy link
Member

mtrezza commented Jun 16, 2022

So this can be closed?

@mtrezza mtrezza added type:question Support or code-level question and removed type:feature New feature or improvement of existing feature labels Jun 16, 2022
@cbaker6
Copy link
Contributor Author

cbaker6 commented Jun 16, 2022

Yes

@cbaker6 cbaker6 closed this as completed Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:question Support or code-level question
Projects
None yet
Development

No branches or pull requests

2 participants