Cloud function Error changing Role

I’m using this cloud function to change users’ role.

Moralis.Cloud.define("changeRole", async (request) => {
  //get Role
  const query = new Moralis.Query(Moralis.Role);
  const roleResults = await query.find({useMasterKey:true}); 
  
  //get User
  const userQuery = new Moralis.Query(Moralis.User);
  query.equalTo("ethAddress", request.params.newUser);
  const userResult = await query.first({useMasterKey:true}); 
 	
  for(let i=0; i<roleResults.length; i++){
      if(roleResults[i].get('name')===request.params.roleName){
        roleResults[i].getUsers().add(userResult)
      }
      roleResults.save()
  {
    
  return request.params.roleName;
});

Now I’m getting this:

Invalid function: “changeRole”
moralis.js:26242 POST https://v8nqcujntcni.usemoralis.com:2053/server/functions/changeRole 400

you can get that error when there is a syntax error somewhere in cloud code

I having the same issue trying to create a new role, unfortunately i am new to Moralis been on this for days now

What is the error that you see?
You can create a new role from the dashboard interface.