Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
4 of 6 tasks
majidhassan opened this issue Jul 7, 2021 · 10 comments
Open
4 of 6 tasks

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

majidhassan opened this issue Jul 7, 2021 · 10 comments
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@majidhassan
Copy link

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

  • 🤩 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: 4.5.0
  • Operating system: Ubuntu 20.04 LTS
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Digital Ocean

Database

  • System (MongoDB or Postgres): MongoDB
  • Database version: 4.4.6
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): MongoDB Atlas

Client (irrelevant as server doesn't start up)

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): FILL_THIS_OUT
  • SDK version: FILL_THIS_OUT

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
Copy link
Member

mtrezza commented Jul 8, 2021

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
Copy link
Author

@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
Copy link
Member

mtrezza commented Aug 1, 2021

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
Copy link
Author

majidhassan commented Aug 8, 2021

@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
Copy link
Member

mtrezza commented Aug 8, 2021

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.

@mtrezza mtrezza closed this as completed Aug 8, 2021
@mtrezza mtrezza added type:question Support or code-level question and removed needs more info labels Aug 8, 2021
@malcolm-dane
Copy link

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
Copy link
Member

mtrezza commented Nov 28, 2021

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

@mtrezza mtrezza reopened this Nov 28, 2021
@parse-github-assistant
Copy link

Thanks for opening this issue!

  • ❌ Please fill out all fields with a placeholder FILL_THIS_OUT, otherwise your issue will be closed. If a field does not apply to the issue, fill in n/a.

@mtrezza mtrezza added type:bug Impaired feature or lacking behavior that is likely assumed state:needs-investigation and removed type:question Support or code-level question labels Nov 28, 2021
@malcolm-dane
Copy link

@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
Copy link
Member

mtrezza commented Nov 29, 2021

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 #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

3 participants