Skip to content

Handle missing feature_segment on version create #7587

@sentry

Description

@sentry

Currently, the API returns a 500 error response when the feature_segment attribute is missing in the POST JSON. We should review

  1. if the FE is sending this, or if this occurrence was manually triggered against our API
  2. a better response to communicate the error to the client

Further details from Sentry:

Sentry Issue: FLAGSMITH-API-5PY

KeyError: 'feature_segment'
(11 additional frame(s) were not displayed)
...
  File "features/versioning/views.py", line 151, in perform_create
    serializer.save(
  File "features/versioning/serializers.py", line 174, in create
    self._validate_segment_override_limit(environment)
  File "features/versioning/serializers.py", line 323, in _validate_segment_override_limit
    segment_ids_to_create_overrides=self.segment_ids_to_create_overrides,
  File "features/versioning/serializers.py", line 164, in segment_ids_to_create_overrides
    if fs["feature_segment"] is not None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions