Problems with cloud functions triggers

this should be something basic

cand you use Moralis.Cloud instead of Parse.Cloud?

I was using that and you change it back hahaha, but sure iā€™ll try again. I hear you, that is my frustration :wink:

Hope we can make it work consistently

Nothing, no result! Any other ideas? Do you want me to nuke this account and start over?? hahaha

In fact, in this server: https://ih9incboqguv.usemoralis.com:2053/server
That is the other one I have in Mumbai, the event fires, but non of the data in request.object works:

const confirmed = request.object.get("confirmed");
const amount = request.object.get("amount");
const buyer = request.object.get("buyer");

This prints empty. But in the table you can see the data.

you can try logger.info(JSON.stringify(request)) to see all the data

Any ideas with the other server?

with the other server ( qddpucpgulyt.usemoralis.com) something is strange, it looks like cloud code is not updating, I tested on a separate server and it works as expected, but somethis is strange with that server, donā€™t nuke it yet

The first one is having a similar problem, the request params are not printing because it is using the first version of function that i deployed. Looks like the account is having the same problem.

how do you update the cloud code? always with moralis-admin-cli?

No Iā€™ve tested with both, with the cli and without, no change with either

can you try to update it on both servers from admin interface? like adding only a comment on a line besides current cloud code

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)