ACL Issues for not logged in users

Hi,

i have a class with all the permissions to public (not ideal, but for testing purposes it is ok), but when using a cloud function to access the data i get always the following error:

“Validation failed. Please login to continue.”

Can someone help me understand what is wrong so i can fix it.

Below is a pic if the class settings

Regards

From a cloud function you can use the master key

Hi,

thanks for the fast reply, but the master key is already being used

Moralis.Cloud.define("getArtistByURL", async (request) => {
  const query = new Moralis.Query("Artist");
  query.equalTo("slug", request.params.slug);
  query.equalTo("is_active", true);
  query.select(
    "objectId",
    "name",
    "slug",
    "dates",
    "bio",
    "avatar",
    "banner",
    "is_active",
  );
  const result = await query.first({useMasterKey:true});

  if(!result) return;

  return {
    id: result.id,
    name: result.attributes.name,
    slug: result.attributes.slug,
    dates: result.attributes.dates ? result.attributes.dates : null,
    bio: result.attributes.bio ? result.attributes.bio : null,
    avatar: result.attributes.avatar ? result.attributes.avatar.url() : null,
    banner: result.attributes.banner ? result.attributes.banner.url() : null
  }
});

Regards

This is the line where you get the error?

Hi,

the error i get is
"“Validation failed. Please login to continue.”

The cloud function seems to execute ok - no errors there just the auth error

Regards

And where is that error generated? Or you get it as a response from the cloud function?

Response from cloud function is

{“code”:142,“error”:“Validation failed. Please login to continue.”}

Regards

Can you add some logging in that cloud function with logger.info?

Hi,

how can i do that ?

Regards

You add lines with logger.info(“text 1”); for example and you will see text 1 in your server logs in your server dashboard

Hi,

thanks.
I’ve managed to solve this.

Regards