question

Derevyaga Nikolay avatar image
Derevyaga Nikolay asked

Cloud Script does not respond anything

The cloud script call does not respond back with any useful information, but it is executed correctly (only the answer does not).

Result



Simplified code:

handlers.CheckDailyBonus = function() {
  try {
    console.log("CheckDailyBonus enter");
    ...code
    return CreateDialyBonusResponce(false, streak, streak);
  } catch (ex) {
    console.log(ex);
  }

  function CreateDialyBonusResponce(success, balanceChange, currentStreak, error) {
    var responceForClient = {
      "Success": !error && success,
      "BalanceChange": balanceChange,
      "Streak": currentStreak,
    };
    if (error)
      responceForClient["Error"] = error;

    console.log("CreateDialyBonusResponce responceForClient=" + responceForClient);
    return JSON.stringify(responceForClient);
  }
};

CloudScript
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Citrus Yan avatar image
Citrus Yan answered

Hi @Derevyaga Nikolay,

So, what you mean is that there are no logs returned in the response, is that right? I can see that you are using console.log() to add the loggings, however, this will write them in the console, which is not visible from the response. You might want to use log.info/debug/error to help to debug CloudScript.

Also, here is the doc on Handling errors in CloudScript you may find helpful too.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.