Closed
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
When I improved the session token lookup for LQ triggers from a Parse.Query
to use internal Auth
, I didn't correctly destructure getAuthForSessionToken
. This results in auth.user
always null.
Steps to reproduce
it('LiveQuery with ACL', async done => {
await reconfigureServer({
liveQuery: {
classNames: ['Chat'],
},
startLiveQueryServer: true,
verbose: false,
silent: true,
});
const user = new Parse.User();
user.setUsername('username');
user.setPassword('password');
await user.signUp();
let calls = 0;
Parse.Cloud.beforeConnect(req => {
expect(req.event).toBe('connect');
expect(req.clients).toBe(0);
expect(req.subscriptions).toBe(0);
expect(req.useMasterKey).toBe(false);
expect(req.installationId).toBeDefined();
expect(req.user).toBeDefined();
expect(req.client).toBeDefined();
calls++;
});
Parse.Cloud.beforeSubscribe('Chat', req => {
expect(req.op).toBe('subscribe');
expect(req.requestId).toBe(1);
expect(req.query).toBeDefined();
expect(req.user).toBeDefined();
calls++;
});
Parse.Cloud.afterLiveQueryEvent('Chat', req => {
expect(req.event).toBe('create');
expect(req.user).toBeDefined();
expect(req.object.get('foo')).toBe('bar');
calls++;
});
const chatQuery = new Parse.Query('Chat');
const subscription = await chatQuery.subscribe();
subscription.on('create', object => {
expect(object.get('foo')).toBe('bar');
expect(calls).toEqual(3);
done();
});
const object = new Parse.Object('Chat');
const acl = new Parse.ACL(user);
object.setACL(acl);
object.set({ foo: 'bar' });
await object.save();
});
Actual Outcome
User always null
Expected Outcome
User to be defined
Failing Test Case / Pull Request
- 🤩 I submitted a PR with a fix and a test case.
- 🧐 I submitted a PR with a failing test case.
Environment
Server
- Parse Server version: master
Database
- System (MongoDB or Postgres): mongodb