parse-community / parse-server

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

Parse Cloud function validation crashes server #9172

Open NabilPopo opened 3 months ago

NabilPopo commented 3 months ago

Hello community,

I find a bug when I want to validate email format from input, sdsd

Also it crashed when it returns false sdsdsd

parse-github-assistant[bot] commented 3 months ago

Thanks for opening this issue!

mtrezza commented 3 months ago

Could you create a failing test that demonstrates the issue?

NabilPopo commented 3 months ago

Hello again,

Here I provide another basic example more simple to re-produce the problem

  1. parse Parse.Cloud.define("test", async(request)=>{ return 'hello' }, { fields: { firstname: { required: true, type: String, options: val => val > 2 }, lastname: { required: true, type: String, options: val => val > 2 }, gender: { required: true, type: String, options: val => ['male', 'female'].includes(val) } }, requireUser: true }, )

  2. the request body, try these examples: { "firstname": "", "lastname": "" } { "firstname": "sdfdf", "lastname": "" }

Like so: aa

Thank you!

mtrezza commented 2 months ago

Thanks, would you want to open a PR with that test?

mtrezza commented 2 months ago

@Priyanshu085 Sure, would you want to start by creating a PR with a failing test?