question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Outgoing webhooks should catch `JsonableError` when posting messages

See original GitHub issue

Responses to outgoing webhook replies can be JSON data which is used to post an immediate response. Mostly this consists of a content key, but also currently supports an undocumented widget_content key as well. If the content or widget_content fails validation (e.g. content contains nulls, or widget_content is not a string which contains JSON(! ?)) in check_message in zerver/lib/actions.py, it raises a JsonableError. Unfortunately, the outgoing webook does not catch this, and it bubbles up and fails at the queue worker level: https://sentry.io/share/issue/dbf8873365814ed29f8860e0215eb533/

We should catch JsonableError inside the try/catch block we already have in do_rest_call. Ideally we should use also notify_bot_owner to inform the bot of the exception that was raised.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
alexmvcommented, Mar 18, 2021

@alexmv I raised a PR again and made some changes based on a review, but did not get another review.

Ah! Sorry for not seeing that PR at the time. I’ve left some comments there. @edith007, it sounds like this issue is fairly well in hand, so best to find something else that catches your eye. 😃

1reaction
alexmvcommented, Mar 17, 2021

Hm, I see there was some work on this already once. I’m not sure why @sundargs2000 closed their PR – it was a good start in the right direction. I’m sorry it didn’t get a prompt review, Sundar! We can give it a proper review if you want to re-open it.

@edith007, if @sundargs2000 doesn’t want to pick this back up, or we don’t hear back in a couple of days, I can assign it to you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Outgoing Webhooks - Slack API
Outgoing webhooks was a quirky way to send your own server a webhook when messages met a narrow set of criteria. We recommend...
Read more >
Webhooks - Atlassian Developer
What happens if the remote system doesn't "catch" the webhook POST? In this case, Jira will log an error in the log file ......
Read more >
Using Webhooks - Tadabase
A webhook is a method of enabling apps to communicate with one another. With Tadabase, you can send webhooks to communicate with other...
Read more >
Setting up an outgoing webhook to an external url on table insert
If I can't get ServiceNow to send the data via an outbound REST message, I guess I will just have to use Powershell...
Read more >
Use incoming webhooks to get real-time updates - Stripe
Stripe sends events to your webhook endpoint as part of a POST request with a JSON payload. Check event objects. Each event is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found