WARNING: failed inside handle_json_callback

I have downloaded the SDK and start playing around to write my own Widget.
I have created one, it ran ok under the Simulator environement but while I side loaded that to my watch I geting the iQ exlemation mark and the following under /APPS/LOGS/

ERROR: Unhandled Exception
DETAILS: Failed invoking <symbol>
STORE_ID: 00000000000000000000000000000000
CALLSTACK:

WARNING: failed inside handle_json_callback
STORE_ID: 00000000000000000000000000000000

WARNING: Unfreed memory on exit
STORE_ID: 00000000000000000000000000000000


So I though that I made something wrong with my first widget and go for one of yours samples downloaded together with SDK.
I talking here about
connectiq-sdk-win-2.2.1\samples\WebRequest

I have compiled that, and again it ran under simulator, but the same error I can see on my watch.

Garmin, please help to figure out, what I doing wrong and give me some clues what can be done in order to fix it?
Thanks in advance.
  • What watch/firmware are you running on?
  • I am using vivoactive with FW: V4.30 and Connect IQ: 1.3.3
  • Here is also excerpt of the Web request I wrote:

    function makeRequest() {
    notify.invoke("Executing\nRequest");

    Comm.makeWebRequest(
    "login:[email protected]:port/json.htm,
    {
    "type" => "devices",
    "filter" => "tmep",
    "user" => "true",
    "order" => "Name"
    },
    {
    "Content-Type" => Comm.HTTP_RESPONSE_CONTENT_TYPE_JSON
    },
    method(:onReceive)
    );
    }

    // Set up the callback to the view
    function initialize(handler) {
    Ui.BehaviorDelegate.initialize();
    notify = handler;
    }

    // Receive the data from the web request
    function onReceive(responseCode, data) {
    var mie = data["result"].toString().substring(301, 305);
    var zab = data["result"].toString().substring(848, 852);
    var zew = data["result"].toString().substring(1396, 1400);

    notify.invoke("Mieszkanie: " + mie +" C\n" +
    "Zabudowa: " + zab +" C\n" +
    "Zewnetrzny: " + zew +" C\n");


    }
  • Have you run it under the simulator? Chances are that the data is not formatted as you expected and your index looking is failing. You need to write code that validates the structure that you expect, and errors out of it isn't there. Otherwise any of those calls can crash.
  • I ran that widget under simulator and it it working.
    I know the quality of that peace of code is rubbish, but here is the excerpt of SDK sample and that fails too so it is not the case:

    unction makeRequest() {
    notify.invoke("Executing\nRequest");

    Comm.makeWebRequest(
    "https://httpbin.org/get",
    {
    "Monkeys" => "Awesome",
    "ConnectIQ" => "1337"
    },
    {
    "Content-Type" => Comm.REQUEST_CONTENT_TYPE_URL_ENCODED
    },
    method(:onReceive)
    );
    }

    // Set up the callback to the view
    function initialize(handler) {
    Ui.BehaviorDelegate.initialize();
    notify = handler;
    }

    // Receive the data from the web request
    function onReceive(responseCode, data) {
    if (responseCode == 200) {
    notify.invoke(data["args"]);
    } else {
    notify.invoke("Failed to load\nError: " + responseCode.toString());
    }
    }
  • Former Member
    Former Member
    Hey,

    I've set up a ticket to investigate this further. I can't reproduce what you are seeing with our code. However, I am getting the same error with yours. I'm going to run this by the team and see what is going on. Thanks for your patience.

    -Coleman
  • Thank you for that information. Awaiting some news from you and your Team.
  • Former Member
    Former Member
    As of right now we are still not able to reproduce the issue. If you are willing, we can keep digging. The best way for us to see what's going on would be to look at the source. Would you be willing to send me the source via PM or email at [email][email protected][/email]?

    Thanks,
    Coleman
  • Hi,

    I have sent you project folder to look at.


    Thanks for supporting.
  • Former Member
    Former Member
    Hi,
    also few users of my app are reporting the problem.

    FYI,
    Garmin opened for me a ticket 10 days ago, I shared my mc code too.

    Hope the Garmin Team can help us quickly.