beforeSave data validation

I have a beforeSave on MyClass, but I can’t get the data validation to work/respond at all. What am I missing? What Parse Server version is this supported from?

Parse.Cloud.beforeSave(MyClass, (request) => {

  // my beforeSave logic (runs as expected)

},{
  fields: {
    identifier : {
      required:true,
      options: identifier => {
        return identifier.length > 0;
      },
      error: 'identifier must be at least one character'
    }
  }
});

Funny enough I just found out about the new Cloud Code Validation feature.

You need to have Parse Server Cloud Code 4.4 - See Cloud Code Documentation

Ahh, I had missed “Available only on parse-server cloud code starting 4.4.0”.

I’m currently running an earlier version, so I’ll stick with my old validation code and will throw an error when needed.

Thanks!

me too, I am still on 3.1.x and will look into upgrading mine to the latest version. Parse server is on 5.x now. lol

Yeah… for this project I’m running my server on Sashido and the latest version they support is currently 3.6.0. I wish they would support new versions (a lot) quicker, but otherwise I am happy with the service. Reliable and stable, and responsive support :slight_smile:

oh wow im on Sashido too. didn’t know 3.6 was the latest version they support. I just opened a ticket not 20 mins ago asking how I could upgrade.

dang.

let me know if you get to upgrade. I’ll message you too if I somehow find a solution. I do need the validation feature.

Just FYI, I was looking into it because of this: How secure is Cloud Code? - #10 by jayson

I did find a way to check for user over there so that works for me right now.

:slight_smile: What version are you currently on?