robwhitaker / habitica-webhook-editor

A better webhook editor for Habitica.
https://robwhitaker.com/habitica-webhook-editor/
MIT License
7 stars 1 forks source link

Multiple webhooks produced at once #1

Open Pyromonk opened 3 years ago

Pyromonk commented 3 years ago

Good day, Rob.

I have not been able to reproduce this bug, so I will just describe what I did:

  1. Deleted existing webhooks (a total of 3) from Habitica's UI.
  2. Logged into your tool to add a new webhook called "Quest Finished". The tool displayed no present webhooks.
  3. Multiple (a total of 3) webhooks with the same properties (label and all) but different UUID's were added.

At first I thought it was because I used a space in the webhook's label, but that wasn't the case. I'm only assuming it's because the number of webhooks I had was "cached" by your tool somehow, so deleting them from Habitica's UI was what messed things up.

Thank you very much for developing this! You saved me quite a bit of time.

Kind regards, Victor

robwhitaker commented 3 years ago

Hey, glad it's been helpful and thanks for the report!

That's a very strange error. The duplicate webhooks were actually created? It wasn't a display bug of some sort? If so, either something went wrong in Habitica's backend or the webhook editor issued the request three different times for some reason. Without the browser's network logs, though, it's hard to say.

Pyromonk commented 3 years ago

@robwhitaker, yep, they were (checked through the tool and Habitica's UI). Sadly, I did not foresee it, so I didn't have the console open at the time...

mornir commented 3 years ago

Hey! Thanks for this tool! I created my first webhook and it also automatically created 3 duplicates.

EDIT: I've just created a new webhook and this time it worked fine, no duplicates.

robwhitaker commented 3 years ago

Hmm... I'll have to have a look through the code again to see if there's anything that might be causing this. Currently, there is no logging in the app (which I prefer from a privacy perspective), so I don't have any runtime data to evaluate. If I can't find anything in the source, though, it might make sense to add some logging to monitor whether or not requests are being sent multiple times by the front-end.

mornir commented 3 years ago

I'd say it's not worth the effort. Maybe the problem is even on Habitica's side (the webhook API is still in beta). It's a pity I didn't have the console open at that moment. But additionally created webhooks can easily be deleted. I had a quick look at the code, but ELM looks very confusing to me 😵

But if you have the time and the motivation, I can highly recommend LogRocket. I guess that you don't have much traffic, so the free plan should be sufficient. Just make sure to obfuscate sensitive data.

But since LogRocket is blocked by most ad blockers, its usefulness might be limited... and then you also probably need to display a cookie notification... so I understand your privacy perspective.

robwhitaker commented 3 years ago

I unfortunately don't have the time at the moment, but I think the way I would tackle logging would just be to create a unique ID (probably just a random number or UUID) for each Webhook Create request I intend to send and log that ID every time the effect of "running the request" happens. So, a normal series of creates might look like:

CREATE 12345
CREATE 75927
CREATE 01849

while a series of duplicates would have the same ID and look like:

CREATE 33333
CREATE 33333
CREATE 33333

I think that would be fairly simple and would keep any user data completely out of the logs.