Problems with cloud functions triggers

Nothing, same result. Don’t worry I’m having to much problems and I’ve lost all day with this. I’m going to try another solution for the ICO and I’ll try back again in the future. :wink:

Really like the product and the idea, but is too inconsistent for me to risk it with so little time.

Thanks anyone for all the help.

I can see that it is not working as expected, I’ll get back when I have updates

That would be great, thanks

it looks like it works now, I tried on qddpucpgulyt server

Hi @cryptokid,
The before save trigger that I defined in the cloud function is triggered. collection creation is successfull but nfts.save() in frontend is happening without request.object.set. In other words, the save process working before my operations in the trigger function are finished. I can see this in the logs. What is the reason?

Moralis.Cloud.beforeSave("Nfts", function(request,response) {
    const userCollection = request.object.get("collection");
    logger.info(JSON.stringify(request.object));
    if (userCollection) {
      logger.info("success");
    } else {
        logger.info("fail");
        const UserCollection = Moralis.Object.extend("UserCollections");
        const collection = new UserCollection();
        collection.set("userId", request.object.get("userId"));
        collection.set("title", "UntitledCollection");
        collection.set("description", "My first collection");
        collection.save(null, { useMasterKey: true }).then((usercollection) => {
        logger.info(JSON.stringify(usercollection));
        request.object.set('collection',usercollection);
        return request.object;
        logger.info(JSON.stringify(request.object));
        });
}
  });

Hi, please see here how to format code on forum:

1 Like

I didn’t understand this part

In short, this line not working.

try to use with await here, and add async to Moralis.Cloud.beforeSave("Nfts", function(request,response) => Moralis.Cloud.beforeSave("Nfts", async function(request,response)