Webhook being published autonomously / posthumously? [Solved]

There have been many posts related to the seeming flakiness of web hooks, and I’ve certainly had my share of struggles with them over the past couple of weeks. Callbacks not being executed, rarely callbacks being executed multiple times for a single publish command (I mean the ENTIRE SET of callbacks being called repeatedly), and worst of all a webhook simply not working anymore and unrecoverable even after reboots, delete and re-create, only to be eventually brought back randomly one day for no reason.

This was all for the matter of learning. I was using the famous get_weather webhook and correlating some of the received data with some local sensor data, and then posting both to Librato. So just a slight variation on the tutorials. Simple enough stuff. But combining the behaviors above with some difficulties I’ve been having with deep sleep mode, and I just didn’t have time to troubleshoot everything at once.

So I removed any reference of the get_weather webhook from my program and at this point am only reading sensor data and posting it to Librato. And so far that has been reliable - no GET hook being published to (that seems to be the source of trouble).

BUT…and this is a BIG but…can someone explain to me why suddenly the get_weather callback is now being very reliably triggered, every 1 minute or so (a periodicity I’ve never used)? I see it on my dashboard. The active program is neither subscribing to nor publishing to that web hook (I didn’t delete the webhook itself), yet it is being triggered! It has been FULLY deleted from my program, and a new program is flashed to the chip. That program is reliably reading and posting sensor data to Librato. The weather data is no longer being posted to Librato, but it IS being triggered according to the dashboard.

Why!!! I’m so confused.

UPDATE: I noticed that the dashboard indicates an “undefined” Device for the incoming webhook responses. I have only a single Spark Core, and yesterday the dashboard only indicated that single core. Today it shows the additional undefined one.

@dpicker,

can you show me how you setup the Webhook? I would give it a try :smile:

Hi @kennethlimcp. Sure, but I am thinking that the fact that my dashboard is showing an undefined core, couple with the fact that the webhook still still seems to be triggering, should be a clue. Maybe there is a rogue core out there that got programmed by me - although the code I had didn’t trigger with that periodicity and, when it was triggering the weather, it was also posting it to Librato.

The actual webhook create looked like this:

From CLI prompt: particle webhook GET get_weather http://w1.weather.gov/xml/current_obs/display.php?stid=KNKX

Nothing special. Exactly like the tutorial, except the URL itself.

The, in setup() I had:

Spark.subscribe("hook-response/get_weather", getHumidity, MY_DEVICES);

In loop() I had, executive anytime between every 30 seconds to every hour, depending upon the version:

Spark.publish("get_weather");

Finally, there is a callback getHumidity() that would get called a sufficient number of times to get the entire contents of the GET, but I’d extract only the humidity and post it to Librato.

However, none of this exists anymore. The currently flashed code is not using any of this, yet my dashboard indicates that get_weather is still being triggered.

Although…I just went to dashboard, thinking I would try to paste an example, and - lo and behold - the phantom undefined device is now gone, along with the get_weather responses. Very, very odd.

Will try and get back to you :smile:

Thanks. By the way, it is still in fact posting to the dashboard. I guess since I had cleared the dashboard the device list disappears until there is an event from that device. It took a few minutes but now it’s back. Thanks for trying, but I don’t suspect the problem will easily duplicate. I had a lot of issues over the past week or two with this, but this latest weirdness was not one of them…This seem to be anomalous.

1 Like

So just to close this topic, it seems to have been resolved in another thread (which I unintentionally hijacked). The webhook (get_weather) was created as a public and not a private webhook, as directed in the examples. This means that anyone else following the example and publishing to get_weather might be triggering my webhook (it’s still not clear to me how Particleis formally resolving duplicate name webhooks, but I’ll avoid that in the future). So the phantom “undefined” device which had been triggering get_weather responses seems to be some other users’ device. I’m going to delete that webhook now and hopefully the responses will stop coming. Thanks to everyone who helped.

1 Like

For completeness, i have sent in the fix here: https://github.com/kennethlimcp/particle-cli/commit/e4a710b372aafacf19714ade1f4c34098e91191f

1 Like