Flagsmith / Flagsmith/flagsmith

influx_query_manager doesn't catch ApiException, so Influx error responses 500

Open Beginner friendly
#8,510 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
6.6k
Forks
567
Avg merge
1d 13h
Merged PRs (30d)
121

Description

`influx_query_manager` catches `urllib3.exceptions.HTTPError`, which covers
connection failures but not error *responses* — `influxdb_client.rest.ApiException`
subclasses `InfluxDBError`. So a 400/401/429/5xx from Influx propagates and 500s
the caller instead of degrading to an empty result. `write()` on the same class
already catches both.

```diff
- except HTTPError as e:
+ except (HTTPError, InfluxDBError) as e:
capture_exception(e)
return []
```

Found via the sales dashboard, where `get_events_for_organisation` 500s the
organisation page if Influx responds with an error. CI never hits it because
there is no Influx service, so every query fails at the socket and is swallowed.

Contributor guide

Open the contributing guide

Research direction

Start at the `influx_query_manager` class and compare its query error handling with `write()`, which already catches both exception types. Check the existing tests around this class if available; done means Influx error responses are captured and queries degrade to an empty result instead of propagating a 500.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.