parse-community / parse-community/parse-server
Live query not working
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
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest version of Parse Server.
Issue Description
I'm facing an issue with live queries.
The client receives the "open" event but doesn't receive the "create" or "update" events.
Server setup:
var app = express();
app.use(compression());
app.enable('trust proxy');
app.use(bodyParser.json({limit: '50mb'}));
app.use(compression());
app.use(cookieParser());
app.use(device.capture());
app.use('/parse', new ParseServer({
databaseURI: DATABASE_URI,
appId: APP_ID,
masterKey: MASTER_KEY,
serverURL: 'http://localhost/parse',
cloud: __dirname + '/cloud/main.js',
liveQuery: {
classNames: ['Order', 'Sale']
}
}));
app.set('view engine', 'ejs');
app.use('/', routes);
const httpServer = require('http').createServer(app);
httpServer.listen(80);
var parseLiveQueryServer = ParseServer.createLiveQueryServer(httpServer);
Client setup:
Parse.initialize(APP_ID);
Parse.serverURL = 'http://localhost/parse';
var query = new Parse.Query('Sale');
query.equalTo('status','pending');
var subscription = await query.subscribe();
subscription.on('open', () => {
console.log('subscription opened');
});
subscription.on('create', (object) => {
console.log('object created',object);
});
subscription.on('update', (object) => {
console.log('object updated',object);
});
Environment
"axios": "^0.21.1",
"body-parser": "^1.19.0",
"card-validator": "^8.1.1",
"compression": "^1.7.4",
"cookie-parser": "^1.4.5",
"coordenadas-do-cep": "^1.2.0",
"ejs": "^3.1.5",
"excel4node": "^1.7.2",
"express": "^4.17.1",
"express-device": "^0.4.2",
"fs": "0.0.1-security",
"http": "0.0.1-security",
"https": "^1.0.0",
"image-search-google": "^1.3.0",
"parse-dashboard": "^2.1.0",
"parse-server": "^4.5.0",
"path": "^0.12.7",
"request": "^2.88.2",
"serve-favicon": "^2.5.0",
"shelljs": "^0.8.4"
Server
- Parse Server version: ^4.5.0
- Operating system: Windows & Linux
- Local or remote host: localhost
Database
- System : MongoDB
- Database version: v4.4.6
- Local or remote host: Google Cloud
Client
- SDK: JavaScript
- SDK version: 3.3.0
Logs
info: Create new client: 3e332475-fabe-488c-9a9c-fd6b69cc3ce6
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 with the liveQuery configuration in ParseServer and the ParseServer.createLiveQueryServer(httpServer) entry point, then reproduce the shown Sale subscription with a pending query. Compare the open event with matching create and update events and use the reported client-creation log as the initial observation; done means establishing why matching events are not delivered and verifying the corrected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, mongodb, nodejs
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100