parse-server: Parse Cloud Code Function won't allow Queries, or any object manipulation through cloud code.
New Issue Checklist
- [X ] I am not disclosing a vulnerability.
- [X ] I am not just asking a question.
- [ X] I have searched through existing issues.
- [X ] I can reproduce the issue with the latest version of Parse Server.
Issue Description
Repeated errors in cloud code function using queries. Setting no user in the fields, using master key etc doesn’t allow for queries,object manipulation etc. Throws error: Parse error: TypeError: Cannot read property ‘protectedFields’ of undefined {“code”:1,“stack”:“Error: TypeError: Cannot read property ‘protectedFields’ of undefined\n at /app/node_modules/parse-server/lib/Controllers/DatabaseController.js:1170:21\n at processTicksAndRejections (internal/process/task_queues.js:95:5)”}
Steps to reproduce
I had the latest Parse Server, dropped it down to a few months old, and still the bug was there. Create cloud function to Query an Object and return an array etc. Manually created mongoatlas entries and tried to query them via cloud function, these items had no permissions set. master key was set to be used, and user set to false.
Actual Outcome
I have gotten several errors similiar to this or like this one:
error: Parse error: TypeError: Cannot read property ‘protectedFields’ of undefined {“code”:1,“stack”:“Error: TypeError: Cannot read property ‘protectedFields’ of undefined\n at /app/node_modules/parse-server/lib/Controllers/DatabaseController.js:1170:21\n at processTicksAndRejections (internal/process/task_queues.js:95:5)”}
Expected Outcome
For it to atleast return something retrieved from the backend
Environment
Heroku 20 Parse Server 4.10.0 -> latest build. Updated Node, downgraded node etc. Didn’t go too long ago in version numbers.
Server “parse”: “3.4.0”, “parse-server”: “4.10.0”
- Parse Server version: 4.10 but also latest
- Operating system: `Ubuntu’
- Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc):
heroku
Database
- System (MongoDB or Postgres):
atlas - Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc):
Atlas
Client
- SDK (iOS, Android, JavaScript, PHP, Unity, etc):
REST
Logs
error: Parse error: TypeError: Cannot read property ‘protectedFields’ of undefined {“code”:1,“stack”:"Error: TypeError: Cannot read property ‘protectedFields’ of undefined\n at /app/node_modules/parse-server/lib/Controllers/DatabaseController.js:1170:21\
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 34 (9 by maintainers)
EDIT: @mtrezza I found it… the SchemaCache is globally! I needed to clear it before each start of a test with
SchemaCache.clear();. This should be documented somewhereI’ll send a summary of notes about the problems with deploying the parse Server example, and in a week or two I can link you a demo repo. I just need to set up the mailgun and every part of the framework will be working right out of the box on Heroku(Checked), and Amazon. It was hard enough to troubleshoot that one of my colleagues started using one of those providers that offer an environment specifically for Parse. We use it for rapid prototyping and demo proof of concepts for iot solutions , but I’ve had it in production before with no issues.
On Sat, Jan 1, 2022 at 5:08 PM Manuel @.***> wrote: