parse-community / parse-community/parse-server
beforeSubscribe, onLiveQueryEvent and afterLiveQueryEvent hooks are not called (LiveQuery)
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 21.4k
- Forks
- 4.8k
- Avg merge
- 7h 45m
- Merged PRs (30d)
- 11
Description
New Issue Checklist
- Report security issues confidentially.
- Any contribution is under this license.
- Before posting search existing issues.
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at ParseServer.createLiveQueryServer and the Parse.Cloud.beforeSubscribe, onLiveQueryEvent, and afterLiveQueryEvent hook entry points. Reproduce with the shown Live Query and Redis configuration and an Android subscription, then trace why the hooks receive no events. Done means each expected hook is called for the corresponding Live Query activity.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, javascript, nodejs
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100