Skip to content

query and payload fields in _PushStatus encoding are incorrect #8030

Closed
@cbaker6

Description

@cbaker6

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:questionSupport or code-level question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions