parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

beforeSubscribe, onLiveQueryEvent and afterLiveQueryEvent hooks are not called (LiveQuery)

Open hej2010 opened this issue 1 year ago • 1 comments
trafficstars

New Issue Checklist

Issue Description

With Live Query configured and running, the Parse.Cloud.beforeSubscribe, Parse.Cloud.onLiveQueryEvent and Parse.Cloud.afterLiveQueryEvent hooks in cloud code are never called. The Parse.LiveQuery.on and Parse.Cloud.beforeConnect hooks receive events, as well as the Android app subscribing to a query.

Steps to reproduce

liveQuery: {
    classNames: ['Message'],
    redisURL: 'redis://localhost:6379'
}
const app = express();
let httpServer = require('http').createServer(app);
httpServer.listen(port);
const parseLiveQueryServer = ParseServer.createLiveQueryServer(httpServer, {redisURL: ...});

and subscribing to a query in e.g. Android:

ParseQuery<ParseObject> parseQuery = new ParseQuery<>("Message");
SubscriptionHandling<ParseObject> subscriptionHandling = liveQueryClient.subscribe(parseQuery);

Actual Outcome

The Android app receives all events (create, update, delete, etc.) but the cloud code hooks (e.g. afterLiveQueryEvent) never run.

Expected Outcome

The hooks are called.

Environment

Server

  • Parse Server version: 7.0.0
  • Operating system: Ubuntu server
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): VPS

Client

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

Logs

The live query server starts and logs Create new client: ... when the Android app connects/disconnects, but no other logs show up from the cloud code/Parse. Tested with and without redis.

hej2010 avatar Apr 16 '24 14:04 hej2010

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.