Catch HTTP Send errors

Hi all,

I’m integrating Sentry in an IoT device, which can run Node.js (Modified RPI 4). I’ve integrated Sentry in the software, but because it’s not a server running 24/7 in a datacenter, it can lose its internet connection sometimes. If something goes wrong when the internet connection is down, I’d like to know if it’s connected again. But there isn’t any support for that, as far as I know.

One solution I could come up with is saving every event in an SQLite database using the beforeSend function and returning null, so it doesn’t send it directly. And creating a cronjob that reads all the SQLite rows and sends it to Sentry, via a custom HTTP request.

But it’d be so much better if it only saves to the SQLite database if the request fails the first time. The cronjob still has to run, but most of the time the device has internet and I’d like to know the errors asap and don’t want to store unnecessary events.

Is this even possible what I’m trying to do? And what would be the best implementation for this?

Thanks in advance!