Cloud function not returning all data from front-end but from within dashboard console

I have a cloud function that Im calling from my front-end which returns only 2 out of over 300 values. When I run the same function from the dashboard js console it returns all items. All collections are public read and write.

Calling this from front-end gives me 2 results

   */
  tokenBalanceChange: async (from_date, min_eth_value, max_eth_value) => {
    return await Moralis.Cloud.run("getTokenBalanceChange", {
      from_date,
      min_eth_value,
      max_eth_value
    });
  }

Calling this from cloud console gives me hundreds of results, parameters passed are the same.

const r = await Parse.Cloud.run("getTokenBalanceChange", {from_date:1648208887278 ,min_eth_value:0, max_eth_value:10000000000000});

Can you try to add some logging in that cloud function to see if there is any difference for the parameters?

The params from the functions that are involved are identical.

getTokenBalanceChange calls getCombinedTokenBalances twice. One time with a date param, and one time without. The log shows everything correctly and from front-end I do get 2 results. When I use the same parameters from the js consoleI get way more tho.

here is the log

2022-03-26T10:43:31.118Z - Ran cloud function getTokenBalanceChange for user 8fO5QXSzNdSci03Yx34q5pK9 with:
  Input: {"from_date":1648262610155,"min_eth_value":0,"max_eth_value":"10000000000000"}
  Result: []
2022-03-26T10:43:31.117Z - Ran cloud function getCombinedTokenBalances for user undefined with:
  Input: {"min_eth_value":0,"max_eth_value":"10000000000000"}
  Result: []
2022-03-26T10:43:30.423Z - getCombinedTokenBalances {"min_eth_value":0,"max_eth_value":"10000000000000"}
2022-03-26T10:43:30.420Z - Ran cloud function getCombinedTokenBalances for user undefined with:
  Input: {"from_date":1648262610155,"min_eth_value":0,"max_eth_value":"10000000000000"}
  Result: []

the behaviour is consistent every time?

yes its always the same behaviour

can you run now those to cases? I’ll look in server logs

I rebootet the server and now it seems to work lol

1 Like