IoT device can't resolve Netlify sites/apis

I’m trying to wire up an IoT device to reach the APIs of one of my sites ( /, and it can’t establish a connection. I’m using CircuitPython/MicroPython so it has some limitations, but I’m hoping to get some pointers before I just wander the potential depths of this problem (I’m relatively new to playing around with embedded code like this as opposed to my web day job). I don’t get a ton of info about the failure, simply getting Sending request failed at what seems to be during TLS negotiation?

Things I’ve tried:

  • I’ve tried connecting to neither my custom domain nor my apps underlying netlify domain works.
  • I’m trying to POST to an API route, but even trying to GET the index page fails.
  • This problem appears to happen for all Netlify apps, not just mine. I tried reaching any of my other apps and also / (from the showcase) and they all fail as well.
  • I can access my sites on other similar providers without issue: eg * for Firebase and * for Heroku
  • I can access other non-Heroku domains I have through my same registrar.

So with all of the above, I’m pretty confident that Netlify is doing something different as the root cause since it is the only commonality breaking my CircuitPython requests library. I was hoping to get some hints about how Netlify’s setup might be causing this issue (I vaguely recall reading something about Netlify doing something tricky w/r/t to request resolution or something a few months back?). I tried seaching to no avail, but I assume other people must be trying to do something similar. Ultimately I can set up a proxy at one of the other providers as a last resort, but I want to make this work.

Hi there and sorry to hear about the trouble!

We’d need to get some more details about what the failure looks like in practice- The message Sending request failed sounds at first blush like couldn’t even connect, but we don’t know that library nor its error messages, and can’t become familiar with it, so perhaps you can get some more verbosity out of it as a first step? I do think you’re sniffing around in the right area trying a GET and trying multiple sites, but we don’t know if it’s something DNS related (unlikely since yourself and use entirely different DNS providers, google domains vs gandi), not following HTTP redirects, SSL negotiation problems, failure to send HOST HTTP request header and thus receiving a 404, etc - so we don’t know what to debug.

At a minimum you could perhaps determine what the User-Agent it sends is, so we can try to find its connections in our internal logs, and let us know a timestamp + timezone for your attempted request?

Adding verbosity would still be my preferred debugging path, but if that’s not possible or easy, we can try looking from our side once you have those details about your attempt.

Hey, thanks for the response. I totally recognize that my troubleshooting info doesn’t give that many leads and was optimistically hoping for a “oh yeah, we do this interesting networking thing that might be giving you trouble or something”. Embedded programming is not my day job, so I was going pretty into the wilderness digging into the C (via MicroPython) libraries and WiFi coprocessor in this device :cold_sweat:(Adafruit MagTag - 2.9 Grayscale E-Ink WiFi Display : ID 4800 : $34.95 : Adafruit Industries, Unique & fun DIY electronics and kits for reference).

After tracing the error path to the WiFI coprocessor (Adafruit_CircuitPython_Requests/ at 26b2411780f69edece156c25476359242446bac0 · adafruit/Adafruit_CircuitPython_Requests · GitHub) I’d reached quite a steep knowledge gap :volcano:. I only tried this with MicroPython/CircuitPython and did not switch to an Arduino bootloader, which would have been the next troubleshooting step. Instead at that point, since I was using Supabase as my backing store, I tried switched to accessing it’s API directly and was able to connect without issue. This whole thing reminds me of using SNI early on when support wasn’t widespread, so I’m chalking it up to something like that, but it is still really confusing that Netlify is the only service (so far at least) that this device/library can’t resolve.

FWIW, the UA is “Adafruit CircuitPython” and the requests were all made around the time I posted my initial question (sorry for the delay, holidays got in the way). I’m not sure how many other people are trying to set up IoT projects against Netlify function endpoints instead of standard servers, so I might be a pretty unrepresentative user in this particular case :grinning:.