Skip to content

TypeError: Cannot read property 'protectedFields' of undefined #8406

New issue

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

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

Already on GitHub? # to your account

Closed
4 tasks done
dplewis opened this issue Jan 26, 2023 · 1 comment · Fixed by #8409
Closed
4 tasks done

TypeError: Cannot read property 'protectedFields' of undefined #8406

dplewis opened this issue Jan 26, 2023 · 1 comment · Fixed by #8409
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@dplewis
Copy link
Member

dplewis commented Jan 26, 2023

New Issue Checklist

Issue Description

If there are no classLevelPermissions in the schema perm below is undefined thus the error. A simple check should fix this issue since a check for perm already exist within the filterSensitiveData function but I'm not familiar with protectedFields.

// fields not requested by client (excluded),
//but were needed to apply protecttedFields
perms.protectedFields &&
perms.protectedFields.temporaryKeys &&
perms.protectedFields.temporaryKeys.forEach(k => delete object[k]);

Steps to reproduce

I accidentally ran into this issue while fixing a flaky test on the JS SDK. I don't have a way to reproduce this error server side.

Actual Outcome

Unhandled promise rejection

Expected Outcome

No errors

Environment

Server

  • Parse Server version: 6.0.0-alpha.27
  • Operating system: Mac
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): local

Database

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

Client

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

Logs

@parse-github-assistant
Copy link

parse-github-assistant bot commented Jan 26, 2023

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

@mtrezza mtrezza added the type:bug Impaired feature or lacking behavior that is likely assumed label Jan 26, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants