makeWebRequest works in simulator, -300 response on Fenix 7X

The log file on the watch just has a -300 response, nothing else is provided to put in the log.

I tried resyncing the watch from the Connect IQ app on my Pixel 7, no luck.

I enabled WiFi on the watch and did a WiFi sync which worked, but after that still -300.

There's no connection attempts from the watch in the server log.

It's an actual registered domain name with a functioning DNS in the url, not an IP address. It's a Let's Encrypt certificate, not self signed, server is nginx and PHP-FPM.

The JSON response is 530ish bytes, so it shouldn't be a size issue.

No parameters (restful url), options are these:

            {:method => Communications.HTTP_REQUEST_METHOD_GET,
               :headers => {"Content-Type" => Communications.REQUEST_CONTENT_TYPE_URL_ENCODED},
               :responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_JSON},

What else can I look for or try? Again, it works in the simulator so I'm fairly certain it's not a code issue, but this is CIQ so I'm open to "try it this way instead" if that's what it takes.

  • Sounds like you may have a speed issue with the connection

    NETWORK_REQUEST_TIMED_OUT -300

    API Level 1.0.0

    Request timed out before a response was received.

  • Maybe, but the router, server, simulator, and watch are in the same room, on the same network. From the log file:

    onTemporalEvent getTimer 723802031
    requestRetry 1 getTimer 723802339
    2023-12-30 15:29:13 Error: requestNearest response: -300
    requestRetry 2 getTimer 723802699
    2023-12-30 15:29:13 Error: requestNearest response: -300
    requestRetry 3 getTimer 723803104
    2023-12-30 15:29:14 Error: requestNearest response: -300
    requestNearest retry count exceeded

    It looks like the timeout is around 300-400 ms, which seems short, if a timeout is in fact what is happening. The code bails after the third retry. I added getTimer because the times in the log were so close. Again, simulator works OK.

  • Is the server on a separate physical computer to where the simulator runs?  Just wondering aloud if your watch is encountering a firewall?  Can you make a call from your phone to the server successfully?

  • In general. the makeWebRequest will go through your phone, as wifi generally only on when it's used for bulk transfer, so the timeout could be due to the cell network not knowing how to get to a machine on the local network

  • The phone is set for wifi calling, so it's on the same network as everything else. The firewall, both DNS 1 & 2,, PostgreSQL and nginx are all separate VM's on the same ESXi host. The simulator runs in a VMplayer VM on a Slackware computer. Everything including the ubiquiti WAP and that junky DSL modem/router thing from Ma Bell are all on the same network. I have static IPs for each DNS (registered through Network Solutions IIRC) and one for the nginx server. Here's how it looks on the simulator:

    Background: onTemporalEvent getTimer 188251859
    Background: requestNearest getTimer 188251875
    Background: onReceiveNearest getTimer 188251968
    onBackground getTimer 188252015

    From the simulator the web request takes less than 100ms. If I turn off wifi on the phone so it's cell network only and type the url into firefox it comes back pretty quick (I don't have a good way to time it but it's a short fraction of a second) so it seems like all the parts are working. Why the timeout is so so low it doesn't make sense. It really seems like something else is wrong and giving a bogus error message.

  • If you use a different url - a public one with https, do you get a -300 or a valid response on the real device?

    try

    var url="">api.openweathermap.org/.../weather";

  • My url is public. The url you posted gives a 401 error when I click on it, so that might not be a good test. I tried my url on a rest api test site and turn around time for them was around 330 ms. What is the actual timeout for makeWebRequest?

  • 401 is a real error from the server, as you aren't providing things like a location and api key, but it's from the server. and not a -300.

    While DNS may know the name, how does the internet route to it? What IP address are you using?  Is that one that can be reached from "outside"

  • I don't know why, but at some point last night it worked, as I have some new data on my watch face. Tracking down inconsistent behavior is going to be even more fun.