Skip to content
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

Multiple Validation failures causes server crash #8826

Open
4 tasks done
alino20 opened this issue Nov 28, 2023 · 1 comment
Open
4 tasks done

Multiple Validation failures causes server crash #8826

alino20 opened this issue Nov 28, 2023 · 1 comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@alino20
Copy link

alino20 commented Nov 28, 2023

New Issue Checklist

Issue Description

I have multiple fields to validate before saving an object. But in certain conditions, This causes server to crash

Steps to reproduce

Cloud Code:

Parse.Cloud.beforeSave('JobList', async (request) => {}, {
  fields: {
    type: {
      required: true,
      type: String,
      options: ['Option A', 'Option B'],
    },
    project: {required: true},
  },
  validateMasterKey: true,
});

Field project is a pointer to another class.

send a save request with empty project field and an invalid string for type field (Anything other than "Option A" or "Option B").

Actual Outcome

The client receives the response Validation failed. Please specify data for project. but also server crashes!

Expected Outcome

The response can have either one of validation failed messages. but server should not crash.

Environment

Server

  • Parse Server version: 6.4.0
  • Operating system: Windows
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Local

Database

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

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): Parse Dashboard v-5.3.0

Logs

Server writes the following error message in console:

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "Validation failed. Invalid option for type. Expected: Option A, Option B".] {
  code: 'ERR_UNHANDLED_REJECTION'
}
Copy link

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 Nov 29, 2023
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

2 participants