parse-community / parse-server

Parse Server for Node.js / Express
https://parseplatform.org
Apache License 2.0
20.92k stars 4.78k forks source link

TypeError: Cannot read property '*' of undefined #7456

Open majidhassan opened 3 years ago

majidhassan commented 3 years ago

New Issue Checklist

Issue Description

I just upgrade to parse-server 4.5.0 and I'm getting the error below (in the logs section).

I'm running this using docker-compose, the parse container keeps restarting a couple of times with this error, then seems to be working fine. I checked the changelog and specifically #6465 but that doesn't seem to be it, since I'm running parse-server 4.5.0 and mongodb 4.4.6.

Steps to reproduce

Not sure how to reproduce this, because I'm pretty sure not everyone using parse-server 4.5.0 has this issue.

Actual Outcome

Server keeps restarting.

Expected Outcome

Server starts up successfully first time I start it.

Failing Test Case / Pull Request

Environment

Server

Database

Client (irrelevant as server doesn't start up)

Logs

warn: Unable to ensure uniqueness for usernames:  Cannot read property '*' of undefined {"stack":"TypeError: Cannot read property '*' of undefined\n    at SchemaData.get (/app/node_modules/parse-server/lib/Controllers/SchemaController.js:671:84)\n    at SchemaController.enforceClassExists (/app/node_modules/parse-server/lib/Controllers/SchemaController.js:1013:24)\n    at /app/node_modules/parse-server/lib/Controllers/DatabaseController.js:1432:70\n    at processTicksAndRejections (internal/process/task_queues.js:93:5)"}
warn: Unable to create case insensitive username index:  Cannot read property '*' of undefined {"stack":"TypeError: Cannot read property '*' of undefined\n    at SchemaData.get (/app/node_modules/parse-server/lib/Controllers/SchemaController.js:671:84)\n    at SchemaController.enforceClassExists (/app/node_modules/parse-server/lib/Controllers/SchemaController.js:1013:24)\n    at /app/node_modules/parse-server/lib/Controllers/DatabaseController.js:1432:70\n    at processTicksAndRejections (internal/process/task_queues.js:93:5)"}
warn: Unable to ensure uniqueness for user email addresses:  Cannot read property '*' of undefined {"stack":"TypeError: Cannot read property '*' of undefined\n    at SchemaData.get (/app/node_modules/parse-server/lib/Controllers/SchemaController.js:671:84)\n    at SchemaController.enforceClassExists (/app/node_modules/parse-server/lib/Controllers/SchemaController.js:1013:24)\n    at /app/node_modules/parse-server/lib/Controllers/DatabaseController.js:1432:70\n    at processTicksAndRejections (internal/process/task_queues.js:93:5)"}
warn: Unable to create case insensitive email index:  Cannot read property '*' of undefined {"stack":"TypeError: Cannot read property '*' of undefined\n    at SchemaData.get (/app/node_modules/parse-server/lib/Controllers/SchemaController.js:671:84)\n    at SchemaController.enforceClassExists (/app/node_modules/parse-server/lib/Controllers/SchemaController.js:1013:24)\n    at /app/node_modules/parse-server/lib/Controllers/DatabaseController.js:1432:70\n    at processTicksAndRejections (internal/process/task_queues.js:93:5)"}
TypeError: Cannot read property '*' of undefined
    at SchemaData.get (/app/node_modules/parse-server/lib/Controllers/SchemaController.js:671:84)
    at SchemaController.enforceClassExists (/app/node_modules/parse-server/lib/Controllers/SchemaController.js:1013:24)
    at /app/node_modules/parse-server/lib/Controllers/DatabaseController.js:1432:70
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
mtrezza commented 3 years ago

Thanks for reporting.

Not sure how to reproduce this

Do I understand correctly that this happened only once, you never observed this anymore, and you are not able to reproduce it, because you don't have the issue-causing image anymore?

majidhassan commented 3 years ago

@mtrezza hey, thanks for replying.

The issue happened several times. I could give you a bit more context, so I have a snapshot of my server on Digital Ocean, and I spawned a droplet from that snapshot. Whenever the droplet spins up (and the docker container is created) I get the error mentioned above for about three to four times (which causes the parse container to restart) and then all is good.

This happened every time I spawned a droplet, but never happened locally even though I was using the same Docker image.

mtrezza commented 3 years ago

Could you to look at your DB and see whether there are any changes regarding your indices in the User collection after each restart? If you cannot reproduce this during debugging, you could also add additional logging where the error occurs in Parse Server to see what causes the undefined value that causes this error.

majidhassan commented 3 years ago

@mtrezza thanks for your reply. I just tried to reproduce, and stopped getting this error. However, I checked the indexes, and it doesn't seem like new indexes are added with each restart.

mtrezza commented 3 years ago

Thanks for the update. I understand that you could not reproduce the issue anymore. I'm closing this as it seems to be resolved. Feel free to comment if you have any questions and we can re-open this issue.

malcolm-dane commented 2 years ago

I'm also having this issue! I can't figure out how to fix it. Can't run Cloud Code Queries, dropped version down to 4.10.0.

mtrezza commented 2 years ago

@malcolm-dane If you can reliably reproduce the issue, then we can look into it.

parse-github-assistant[bot] commented 2 years ago

Thanks for opening this issue!

malcolm-dane commented 2 years ago

@malcolm-dane If you can reliably reproduce the issue, then we can look into it.

I'm not too sure what exactly is causing it, but it's related to something in the middleware. I've received the schema error, and a related data basecontroller error. I can't do cloud functions that search database items, I've gotten the same errors as above, and another error related to the database controller.

I am planning on building the server from source, deploying it and seeing if the error persists. It appears that useMasterKey is ignored, along with requireUser set to false being off.

Any ideas what can be causing this? If I remember correctly version 3 didn't have this issue.

mtrezza commented 2 years ago

I am not sure how to support at this point as I don't fully understand the issue. This may be related to your other issue https://github.com/parse-community/parse-server/issues/7728, both of which lack a specific example to reproduce the issue. Maybe if you debug Parse Sever, set some breakpoints and look into what is causing these issues, you get some hints.