Skip to content

Inconsistent feature_state_value Type Between Edge Proxy and Edge API Endpoint when number is used as value #137

@ravindra-dyte

Description

@ravindra-dyte

Description

When using Flagsmith's Edge Proxy, the feature_state_value is returned as a string (e.g., "3000"). However, when directly using the Edge API endpoint (https://edge.api.flagsmith.com), the same feature_state_value is returned as a number (e.g., 3000). This inconsistency in data types can lead to bugs in client applications relying on the type of this value.

Steps to Reproduce

  1. Set up a Flagsmith feature flag with a feature_state_value of 3000 (or any numeric value).
  2. Retrieve the feature state via the Edge Proxy.
  3. Observe that feature_state_value is returned as a string (e.g., "3000").
  4. Retrieve the feature state via the Edge API Endpoint (https://edge.api.flagsmith.com).
  5. Observe that feature_state_value is returned as a number (e.g., 3000).

Expected Behavior

The feature_state_value should maintain a consistent data type (preferably a number for numeric values) across both Edge Proxy and Edge API Endpoint.

Observed Behavior

Edge Proxy: Returns feature_state_value as a string.
Edge API Endpoint: Returns feature_state_value as a number.

Impact

This inconsistency requires additional checks or parsing in client applications, which could otherwise rely on a consistent data type.

Environment

Flagsmith Environment: Production & Staging
Edge Proxy Docker Tag: 2.17

Suggested Fix

Standardize the feature_state_value data type (e.g., number for numeric values) across both Edge Proxy and Edge API Endpoint responses.

Additional Context

This behavior creates unnecessary complexity when integrating with Flagsmith in environments where both the Edge Proxy and Edge API Endpoint might be used interchangeably. We hit our edge proxy first, if that fails, we hit edge endpoint.

Screenshots

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions