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 Notifications Stuck in 'Sent' Status with Parse Server (Postgres), Not Delivered to Devices #9507

Open
AnahitaHonarmandian opened this issue Dec 26, 2024 · 6 comments
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@AnahitaHonarmandian
Copy link

AnahitaHonarmandian commented Dec 26, 2024

Issue Description

Push notifications sent from the Parse Dashboard remain stuck in the "sent" status and do not get delivered to devices. While using Postgres, the logs show the error:
Postgres doesn't support this query type yet ["e_NgpzQw8xiY8...(all the tokens I got)"].
Despite the curl test succeeding and getting a positive response from the push sending function in the code ({ success: true, message: "Notification sent to devices." }), the notifications do not show up on devices.
Switching to MongoDB is not an option because the server hardware does not support AVX instructions, resulting in an illegal instruction (signal=ILL) error.

Steps to reproduce

Set up a Parse Server with Postgres as the database.
Register a device and get the FCM token.
Try sending a push notification from the Parse Dashboard.
Observe that the notification status in the dashboard remains stuck on "sent" and does not deliver.

Actual Outcome

Parse Dashboard shows notifications stuck in the "sent" status.
Notifications do not appear on registered devices.
Logs include the error:
Postgres doesn't support this query type yet ["e_NgpzQw8xiY8...(all the tokens I got)"].

Expected Outcome

Notifications should be delivered to the registered devices.

Server

Parse Server version: 7.4.0
Parse Dashboard version: 6.0.0
Operating system: Debian GNU/Linux 12 (bookworm)
Local or remote host: Local server

Database

System: Postgres
Database version: 15.3
Local or remote host: Local

Client

SDK: JavaScript
SDK version: 9.6.1 (Firebase Messaging)

Logs

From the Parse Server logs:
Postgres doesn't support this query type yet ["e_NgpzQw8xiY8..."]
From the JavaScript console:
Push notification response: Object { success: true, message: "Notification sent to devices." }

Copy link

Thanks for opening this issue!

@mtrezza
Copy link
Member

mtrezza commented Dec 28, 2024

Are you able to reproduce this without using the Parse Dashboard push UI, for example in Cloud Code or the REST API UI in Parse Dashboard? To determine whether this is a dashboard or server issue. If you can, please post the code.

@mtrezza mtrezza added the type:bug Impaired feature or lacking behavior that is likely assumed label Dec 28, 2024
@AnahitaHonarmandian
Copy link
Author

AnahitaHonarmandian commented Dec 29, 2024

This is my Cloud code:
`
Parse.Cloud.define("sendPushFromDeviceClass", async (request) => {
const { message } = request.params;

const query = new Parse.Query("Device");
query.exists("token"); 

try {
  const devices = await query.find({ useMasterKey: true });

  if (devices.length === 0) {
    throw new Error("No devices found to send notifications.");
  }

  const tokens = devices.map((device) => device.get("token"));

  await Parse.Push.send(
    {
      data: {
        alert: message,
        title: "Notification",
        sound: "default",
      },
      where: {
        tokens,
      },
    },
    { useMasterKey: true }
  );

  return { success: true, message: "Notification sent to devices." };
} catch (error) {
  throw new Parse.Error(Parse.Error.INTERNAL_SERVER_ERROR, error.message);
}

});

`
I ran the curl commands as suggested, and here are the results:
1. Cloud Code (sendPushFromDeviceClass) Test:
Request:
curl -X POST
-H "X-Parse-Application-Id: myAppId"
-H "X-Parse-Master-Key: myMasterKey"
-H "Content-Type: application/json"
-d '{"message": "Hello from Cloud Code!"}'
http://localhost:1337/parse/functions/sendPushFromDeviceClass
Response:
{"result":{"success":true,"message":"Notification sent to devices."}}
Server Logs:
verbose: REQUEST for [POST] /parse/functions/sendPushFromDeviceClass: {
"message": "Hello, this is a push notification from Parse Server!"
}
{"body":{"message":"Hello, this is a push notification from Parse Server!"},"headers":{"..."},"method":"POST","url":"/parse/functions/sendPushFromDeviceClass"}

info: Ran cloud function sendPushFromDeviceClass for user undefined with:
Input: {"message":"Hello, this is a push notification from Parse Server!"}
Result: {"success":true,"message":"Notification sent to devices."}

2. Direct /push API Test:
curl -X POST
-H "X-Parse-Application-Id: myAppId"
-H "X-Parse-Master-Key: myMasterKey"
-H "Content-Type: application/json"
-d '{
"where": {
"deviceType": "web"
},
"notification": {
"title": "Test Title",
"body": "This is a test notification from curl."
}
}' http://localhost:1337/parse/push
Response:
{"result":true}

3. Device Class Data: The following log entry shows the Device object retrieved during the push notification process:
verbose: RESPONSE from [GET] /parse/classes/Device: {
"response": {
"results": [
{
"objectId": "2lWW.....",
"createdAt": "2024-12-24T06:49:26.166Z",
"updatedAt": "2024-12-24T06:49:26.166Z",
"token": "eVzl1d....."
}
]
}
}
4. Test with /push using REST API console in parse dashboard:
Endpoint: /push
Method: POST
Master Key: Enabled
Payload:
{
"where": {
"token": "eVzl1dD....."
},
"notification": {
"title": "Test Title",
"body": "This is a test notification from the REST API Console."
}
}
Response:
{
"objectId": "HxnVf...",
"createdAt": "2024-12-29T06:11:49.950Z"
}

The server logs also show a Postgres query limitation:
error:Postgres doesn't support this query type yet ["e_NgpzQw8xiY8..."]

Both Cloud Code and /push API calls appear to execute successfully, as indicated by the responses and logs. I can successfully see the push notification pop-up when sending directly from the Firebase Console.
However, when sending the same notification from the Parse Dashboard, the push notification gets stuck in the "Sent" status, and no pop-up appears on the client and for example 2 days later the status of push is failed.

@mtrezza
Copy link
Member

mtrezza commented Dec 30, 2024

The server logs also show a Postgres query limitation:
error:Postgres doesn't support this query type yet ["e_NgpzQw8xiY8..."]

Could you clarify for each of the 4 cases:

  • Is the Postgres error logged?
  • Is the server response "success"?
  • Does the notification arrive on the device?

@AnahitaHonarmandian
Copy link
Author

AnahitaHonarmandian commented Dec 31, 2024

Please checkout the screenshots I attached.
While using Cloud Code, no Postgres error in the logs, server responds with success and notifications does not appear on the device.
While using the REST API, no Postgres error in the logs, server responds with success and notifications does not appear on the device.
While Using Parse Dashboard UI, the "Postgres doesn't support this query type yet" error appears in the logs, server response Stuck in "Sent" status in the dashboard and notification does not appear on the device.
1
2
3
4
5

@jimnor0xF
Copy link

jimnor0xF commented Jan 5, 2025

@AnahitaHonarmandian
If you are using web push with FCM, try using rawPayload instead. Pretty sure the payload you are using only works for Android/Apple devices at the moment.

parse-community/parse-server-push-adapter#286 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

3 participants