Flagsmith / Flagsmith/flagsmith

Incorrect Dynamo query in ` /api/v1/environments/{environment_api_key}/edge-identity-overrides`

Open
#6,630 2 comments 0 reactions 0 assignees View on GitHub
api
Dominant language
Python
Stars
6.6k
Forks
567
Avg merge
1d 14h
Merged PRs (30d)
124

Description

Sentry Issue: [FLAGSMITH-API-5H1](https://flagsmith.sentry.io/issues/7225550511/?referrer=github_integration)

```
ClientError: An error occurred (ValidationException) when calling the Query operation: Invalid KeyConditionExpression: KeyConditionExpressions must only contain one condition per key
(12 additional frame(s) were not displayed)
...
File "edge_api/identities/views.py", line 403, in get_edge_identity_overrides
items = edge_identity_service.get_edge_identity_overrides(
File "edge_api/identities/edge_identity_service.py", line 15, in get_edge_identity_overrides
ddb_environment_v2_wrapper.get_identity_overrides_by_environment_id(
File "environments/dynamodb/wrappers/environment_wrapper.py", line 81, in get_identity_overrides_by_environment_id
return list(
File "environments/dynamodb/wrappers/base.py", line 64, in _iter_all_items
query_response = response_getter() # type: ignore[call-arg]
```

Contributor guide

Open the contributing guide

Research direction

Start in environments/dynamodb/wrappers/environment_wrapper.py at get_identity_overrides_by_environment_id, then trace its use from edge_api/identities/edge_identity_service.py and edge_api/identities/views.py. Inspect the DynamoDB query conditions and reproduce the endpoint request. Done means the endpoint no longer raises the KeyConditionExpression ValidationException.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
backend, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.