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
In cloud code, when trying to update an existing object in an afterSave trigger with a context set on call to save, an error is reported and update does not go through. Seems to be some sort of a regression to #6735.
Steps to reproduce
Use the following cloud code:
Parse.Cloud.afterSave('TestObject1', async (request) => {
const TestObj2 = Parse.Object.extend('TestObject2');
const query = new Parse.Query(TestObj2);
const obj = await query.first();
return obj.save(null, { useMasterKey: true, context: { op: 'auto' } })
});
- Create a new class called TestObject2 and a new object of that class.
- Create a new class callsed TestObject1 and a new object of that class.
- afterSave trigger from cloud code above will trigger and fail with the error below.
Actual Outcome
Error is reported, object is not saved:
error: afterSave failed for TestObject1 for user undefined:
Error: {"message":"Invalid field name: _context.","code":105} {"className":"TestObject1","triggerType":"afterSave","error":{"message":"Invalid field name: _context.","code":105}}
warn: afterSave caught an errorInvalid field name: _context. {"code":105,"stack":"Error: Invalid field name: _context.\n at handleError (/home/myak/src/github/parse-server/node_modules/parse/lib/node/RESTController.js:402:17)\n at process._tickCallback (internal/process/next_tick.js:68:7)"}
Expected Outcome
Object is saved, context is available in beforeSave trigger on TestObject1.
Environment
Server
- Parse Server version: 4.3.0
- Operating system: Linux
- Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc):
FILL_THIS_OUT
Database
- System (MongoDB or Postgres): both
- Database version: any
- Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): local
Client
- SDK (iOS, Android, JavaScript, PHP, Unity, etc): n/a
- SDK version: n/a
Metadata
Metadata
Assignees
Labels
No labels