-
Notifications
You must be signed in to change notification settings - Fork 24
Description
JBI could fail at parsing Webhook incoming request with:
- a regression/bug is introduced in our code (eg. while working on Bugzilla Data Modeling (Optional Fields) #234)
- working on new kinds of events (eg. Edits to Bugzilla comments are not synced to Jira #397)
- a change in Bugzilla server
Currently, JBI logs the error and returns HTTP 422
.
We may want to leverage the queue to return HTTP 200
instead and store the payload.
option 0: status quo
Do not change current behaviour
option 1: refactor queue code to allow arbitrary payloads
Current code uses track_failed(payload: bugzilla.WebhookRequest, exc: Exception)
In order to be able to store the invalid incoming payload in the queue, we would have to modify the queue methods and models to allow arbitrary payloads.
This would prevent us from accessing payload attributes like this:
jira-bugzilla-integration/jbi/queue.py
Line 80 in 7f99b9e
return f"{self.payload.event.time}-{self.payload.bug.id}-{self.payload.event.action}-{"error" if self.error else "postponed"}" |
Turning the arbitrary payload into WebhookRequest
would happen explicitly in the retry_failed()
code before calling execute_action()
option 2: add new queue method
Instead of changing the models we could add backend and queue methods:
track_invalid(payload: Any, exc: Exception)
backend.put_raw(item_raw: Any, exc: PythonException)
This would store the content in the queue, assuming that the retry job won't be able to process the content until the code is changed and redeployed.