# Webhook "sleep" errors.... help!

**URL:** <https://community.particle.io/t/webhook-sleep-errors-help/52880>\
**Category:** Cloud\
**Tags:** electron\
**Created:** [October 23, 2019, 4:18am UTC](https://community.particle.io/t/webhook-sleep-errors-help/52880 "2019-10-23T04:18:58Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![SammyG](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sammyg/32/19920_2.png) [@SammyG](https://community.particle.io/u/SammyG)\
**Post date:** [October 23, 2019, 4:18am UTC](https://community.particle.io/t/webhook-sleep-errors-help/52880/1 "2019-10-23T04:18:58Z")

</div>

I have 4 E-Series devices running OS1.4.1. They all send data to Ubidots via a webhook (I am using a webhook rather than the library to save data), and lately they have been showing the “sleep” error in the webhook console logs. I can’t figure out why this is happening… the guys at Ubidots are working on it but they don’t think its on there end.

These 4 devices are sending their Particle.publish()'s at basically the same time, although I’m pretty sure this isn’t an issue.

Here is the full webhook I’m sending by calling `Particle.publish("ubi_board", payload, PRIVATE);`:

```auto
{
    "event": "ubi_board",
    "url": "https://industrial.api.ubidots.com/api/v1.6/devices/{{{PARTICLE_DEVICE_ID}}}",
    "requestType": "POST",
    "noDefaults": true,
    "rejectUnauthorized": true,
    "headers": {
        "X-Auth-Token": "normally my token is here"
    },
    "json": {
        "boxt": {
            "value": "{{boxt}}",
            "timestamp": "{{timestamp}}"
        },
        "boxh": {
            "value": "{{boxh}}",
            "timestamp": "{{timestamp}}"
        },
        "boxp": {
            "value": "{{boxp}}",
            "timestamp": "{{timestamp}}"
        },
        "PTmVavg": {
            "value": "{{PTmVavg}}",
            "timestamp": "{{timestamp}}"
        },
        "PTmVsd": {
            "value": "{{PTmVsd}}",
            "timestamp": "{{timestamp}}"
        },
        "3V3 mA": {
            "value": "{{3V3-mA}}",
            "timestamp": "{{timestamp}}"
        },
        "ORP mA": {
            "value": "{{ORP-mA}}",
            "timestamp": "{{timestamp}}"
        },
        "BattV": {
            "value": "{{BattV}}",
            "timestamp": "{{timestamp}}"
        },
        "RSSI": {
            "value": "{{RSSI}}",
            "timestamp": "{{timestamp}}"
        },
        "FileSize": {
            "value": "{{File Size}}",
            "timestamp": "{{timestamp}}"
        },
        "chrg": {
            "value": "{{CHRG}}",
            "timestamp": "{{timestamp}}"
        }
    }
}

```

and this is the payload that shows up in the console:

```auto
{
"boxt":6.09
"boxh":43.42
"boxp":1003.07
"PTmVavg":29.65
"PTmVsd":0.85
"RSSI":-67
"File Size":344240
"BattV":4.07
"ORP-mA":41.34
"3V3-mA":5.32
"CHRG":1
"timestamp":1571803268000
}

```

The usual particle data is included also. Variations of this webhook, along with a lot of other data, were working intermittently with “sleep” and “ESOCKETTIMEOUT” errors, so I split them up into three separate web hooks. But now, I just keep getting the “sleep” indication when I look at the logs for this webhook.

I really need to get this functioning so I can get my data to Ubidots…

Any help is appreciated!

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [October 23, 2019, 7:05am UTC](https://community.particle.io/t/webhook-sleep-errors-help/52880/2 "2019-10-23T07:05:48Z")

</div>

IIRC the sleep error comes from too many requests that ended in an error (e.g. your `ESOCKETTIMEOUT`) to protect both the target server as well as the Particle infrastructure from devices gone rogue.

I know of reports where the default timeout of 5 seconds was too short for some target servers to respond. I think Particle had to adjust that but only did it for a know set of servers/clients/… (I can’t remember exactly).

@marekparticle may be better able to help out with that.

---

<div class="post-metadata">

**Author:** ![SammyG](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sammyg/32/19920_2.png) [@SammyG](https://community.particle.io/u/SammyG)\
**Post date:** [October 23, 2019, 12:53pm UTC](https://community.particle.io/t/webhook-sleep-errors-help/52880/3 "2019-10-23T12:53:19Z")

</div>

Good info ScruffR! Lets see what Marek says…

As of this morning, some of the requests are getting through. I have 3 devices now sending data every 30 minutes, and one device still only sending data on the hour. Looks like the devices sending data every 30 minutes are getting through ONLY once per hour (on the 30th minute), but when they try to send data on the hour with the 4th device, the webhook sleeps. Hopefully that was clear, I’ve attached a screenshot!

 ![09%20AM](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/8/5/85561ef5584d4782aa7d89dd92ee6797748095e5.png)

---

<div class="post-metadata">

**Author:** ![marekparticle](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/marekparticle/32/22793_2.png) [@marekparticle](https://community.particle.io/u/marekparticle)\
**Post date:** [October 23, 2019, 12:54pm UTC](https://community.particle.io/t/webhook-sleep-errors-help/52880/4 "2019-10-23T12:54:03Z")

</div>

Yup, `ESOCKETTIMEDOUT` is a read timeout, and I believe the 5 second timeout still remains in place (with 3 sets of 3 retries delimited by sleep periods thereafter). I believe @ScruffR’s assertion is correct, though it was before my time at Particle. @SammyG - it’s perhaps worth filing a support request to evaluate whether or not this is a possibility in this instance.

I’d love to see some Device IDs / timestamps in your support request as well, to make sure nothing else is going on!

Edit - OOO simul-reply! Actually, now I _really_ want to see some device IDs.

---

<div class="post-metadata">

**Author:** ![SammyG](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sammyg/32/19920_2.png) [@SammyG](https://community.particle.io/u/SammyG)\
**Post date:** [October 23, 2019, 12:58pm UTC](https://community.particle.io/t/webhook-sleep-errors-help/52880/5 "2019-10-23T12:58:15Z")

</div>

Send you a message Marek!

---

<div class="post-metadata">

**Author:** ![marekparticle](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/marekparticle/32/22793_2.png) [@marekparticle](https://community.particle.io/u/marekparticle)\
**Post date:** [October 23, 2019, 1:10pm UTC](https://community.particle.io/t/webhook-sleep-errors-help/52880/6 "2019-10-23T13:10:24Z")

</div>

Ahhhh, wow. The graph for this is… quite sad. ☹

All looks well within our backend as it presents to me, hm.

Not to:

 ![C-658VsXoAo3ovC](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/3/5/357ef70f61ddfc67d3068f5e7d68df137c156e31.jpeg)  
but given the patterning here it looks like a progressive issue with contacting Ubidots.

I am curious about the results of their investigation. I’ll inquire to see if there’s anything I can do for you with respect to this window. Can you stagger these `Publish()`s at all? It… shouldn’t matter, but they are pretty close together, and it seems like _something_ actionable that can be done we look this over.

---

<div class="post-metadata">

**Author:** ![SammyG](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sammyg/32/19920_2.png) [@SammyG](https://community.particle.io/u/SammyG)\
**Post date:** [October 23, 2019, 1:19pm UTC](https://community.particle.io/t/webhook-sleep-errors-help/52880/7 "2019-10-23T13:19:33Z")

</div>

What kind of stagger? Seconds or minutes?

---

<div class="post-metadata">

**Author:** ![marekparticle](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/marekparticle/32/22793_2.png) [@marekparticle](https://community.particle.io/u/marekparticle)\
**Post date:** [October 23, 2019, 1:23pm UTC](https://community.particle.io/t/webhook-sleep-errors-help/52880/8 "2019-10-23T13:23:11Z")

</div>

If it’s within your power, at least 50 seconds.

---

<div class="post-metadata">

**Author:** ![SammyG](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sammyg/32/19920_2.png) [@SammyG](https://community.particle.io/u/SammyG)\
**Post date:** [October 23, 2019, 1:24pm UTC](https://community.particle.io/t/webhook-sleep-errors-help/52880/9 "2019-10-23T13:24:28Z")

</div>

OK I can try that. Do you mean have each of the devices send the data at different times, or just have this delay between the three particle.publish() calls?

---

<div class="post-metadata">

**Author:** ![marekparticle](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/marekparticle/32/22793_2.png) [@marekparticle](https://community.particle.io/u/marekparticle)\
**Post date:** [October 23, 2019, 1:29pm UTC](https://community.particle.io/t/webhook-sleep-errors-help/52880/10 "2019-10-23T13:29:17Z")

</div>

SammyG, sorry if my intentions are not clear - the idea is to avoid firing this Webhook off 2-3 times in 10-15 seconds. Like you, I’m unconvinced that this will solve the issue, but it’s just a simple troubleshooting exercise.

---

<div class="post-metadata">

**Author:** ![SammyG](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sammyg/32/19920_2.png) [@SammyG](https://community.particle.io/u/SammyG)\
**Post date:** [October 23, 2019, 2:36pm UTC](https://community.particle.io/t/webhook-sleep-errors-help/52880/11 "2019-10-23T14:36:45Z")

</div>

I’m going to try and stagger the systems 1 minute apart from each other. So they send the data at XX:00, XX:01, XX02, and XX:03…

I’ll report back.

---

<div class="post-metadata">

**Author:** ![SammyG](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sammyg/32/19920_2.png) [@SammyG](https://community.particle.io/u/SammyG)\
**Post date:** [October 23, 2019, 8:11pm UTC](https://community.particle.io/t/webhook-sleep-errors-help/52880/12 "2019-10-23T20:11:43Z")

</div>

Ok so I setup the four devices with a stagger such that they _send_ data at XX:58, XX:59, XX:00, and XX:01.

Here are the results:

![09%20PM](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/2/f/2f4d29d174ed4405254d766f9578e9b0badc5bec.png)

So the payloads coming in at XX:58 and XX:59 get through, but the XX:00 and XX:01 are still having issues. Looks like the particle cloud also tries the problem web hooks twice… interesting.

Anyway, there’s the update for now!

---

<div class="post-metadata">

**Author:** ![SammyG](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sammyg/32/19920_2.png) [@SammyG](https://community.particle.io/u/SammyG)\
**Post date:** [October 23, 2019, 8:13pm UTC](https://community.particle.io/t/webhook-sleep-errors-help/52880/13 "2019-10-23T20:13:27Z")

</div>

Ubidots has been very helpful and they’re still working on their end to see if there’s a fix.

---

<div class="post-metadata">

**Author:** ![SammyG](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/sammyg/32/19920_2.png) [@SammyG](https://community.particle.io/u/SammyG)\
**Post date:** [October 24, 2019, 12:33am UTC](https://community.particle.io/t/webhook-sleep-errors-help/52880/14 "2019-10-24T00:33:04Z")

</div>

Ubidots to the rescue!

They found a way to improve the response time for what I was doing.

Thanks everyone for the help.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/particle/original/3X/d/a/da68e3bbabd63c05a3901110a5c0b20b8fd96d6f.jpeg)

---

<div class="post-metadata">

**Author:** ![marekparticle](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/marekparticle/32/22793_2.png) [@marekparticle](https://community.particle.io/u/marekparticle)\
**Post date:** [October 24, 2019, 11:15am UTC](https://community.particle.io/t/webhook-sleep-errors-help/52880/15 "2019-10-24T11:15:23Z")

</div>

Oh wow, that’s fantastic @SammyG! Thanks for keeping us posted!

---

<div class="post-metadata">

**Author:** ![marekparticle](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/marekparticle/32/22793_2.png) [@marekparticle](https://community.particle.io/u/marekparticle)\
**Post date:** [October 24, 2019, 2:41pm UTC](https://community.particle.io/t/webhook-sleep-errors-help/52880/16 "2019-10-24T14:41:34Z")

</div>



---

<div class="post-metadata">

**Author:** ![marekparticle](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/marekparticle/32/22793_2.png) [@marekparticle](https://community.particle.io/u/marekparticle)\
**Post date:** [October 24, 2019, 2:41pm UTC](https://community.particle.io/t/webhook-sleep-errors-help/52880/17 "2019-10-24T14:41:43Z")

</div>


