Webhook executing twice after one Publish command. Zombies?

Hello all

I’ve setup a webhook to the Azure Event Hub - integration works perfect however it seems that Particle is calling the webhook twice instead of once.

Code looks like this:

  Particle.publish("temperatureeventhub", "{\"devicename\":\"" + devicename + "\",\"location\":\"" + location + "\",\"temp\":" + String(fahrenheit) + "}");

In the Particle logs I see two simultaneous webhook events:

hook-sent/temperatureeventhubundefinedJuly 25th at 7:50:22 pmparticle-internal
{"data":"undefined","ttl":"60","published_at":"2016-07-26T02:50:22.821Z","coreid":"particle-internal","name":"hook-sent/temperatureeventhub"}
hook-sent/temperatureeventhubundefinedJuly 25th at 7:50:22 pmparticle-internal
{"data":"undefined","ttl":"60","published_at":"2016-07-26T02:50:22.813Z","coreid":"particle-internal","name":"hook-sent/temperatureeventhub"}

And can confirm the data is duplicated in Event Hub. I’ve tried to delete and rename the webhook to no avail! Any clues what may be going on?

Thanks!
Derek

Hello Derek, I’m pinging our lead developers here: @bryce and @jeiden here.

It would also help if you can provide more context. Is the publish event in a loop or triggered by something?

Hi Mohit

Yes, the Publish command is in a loop; however there is a delay following the Publish command so I know that the duplication is likely caused by the single Publish method. As I watch the publish output in the Dashboard Log I see:

  • “TemperatureEventHub” followed by the JSON issued during Publish
  • “hook-sent/temperatureeventhub” followed with the JSON configured in the webhook
  • “hook-sent/temperatureeventhub” (this seems to be the duplicate) followed with the JSON configured in the webhook

Note that the Published times for all three events are exactly the same.

Here is the code:

void loop(void) {
  float fahrenheit = getTemp();
  sendDataToEventHub(fahrenheit);

  delay(9999);
}

void sendDataToEventHub(float fahrenheit) {
  Particle.publish("temperatureeventhub", "{\"devicename\":\"" + devicename + "\",\"location\":\"" + location + "\",\"temp\":" + String(fahrenheit) + "}");
}

If you delete the webhook and recreate it, does the same thing happen?

Yes, if I delete the webhook and re-create it the behavior is the same. I’ve also tried to delete the webhook and create it again with a new event name and it still gets duplicated.

Even more strange things: I created a new webhook with a separate Event Hub (with a separate event name) and for the newly created webhook the hook only gets invoked once!

Is it possible that the problematic hub still has something left over even after the delete operation?

I see two different webhooks using the same event name under two different users. It is possible if you were publishing public events, that both were triggering. Since webhooks triggering on public webhooks are no longer allowed this shouldn’t be a problem.