flagsmith: Bug: Flagsmith returning 502 on /identities API

Describe the bug We have integrated the /identities API and we are trying to call it with the following payload but there seems some issue with this data - Here when identifier is 68385f9726ad05c8e551a8d5be5cd8213f1e733346a9eb00e86f83df94639555, API returns 502 but when it’s any other test identifier it works. Also, I tried to replicate it with a different env key, there we don’t see 502. This is only happening with the env key that we are using.

-> Request

curl --location 'https://edge.api.flagsmith.com/api/v1/identities' \
--header 'X-Environment-Key: <key>' \
--header 'Content-Type: application/json' \
--data '{
    "identifier": "68385f9726ad05c8e551a8d5be5cd8213f1e733346a9eb00e86f83df94639555",
    "traits": [
        {
            "trait_key": "instanceId",
            "trait_value": "650c79f77ade126caf5852fa"
        },
        {
            "trait_key": "isTelemetryOn",
            "trait_value": false
        },
        {
            "trait_key": "tenantId",
            "trait_value": "650c79fa7ade126caf585309"
        },
        {
            "trait_key": "type",
            "trait_value": "user"
        },
        {
            "trait_key": "email",
            "trait_value": "68385f9726ad05c8e551a8d5be5cd8213f1e733346a9eb00e86f83df94639555"
        },
        {
            "trait_key": "defaultTraitsUpdatedAt",
            "trait_value": 1695316874
        }
    ]
}'

To Reproduce

Steps to reproduce the behavior:

  1. Make a request from the above-shared curl with the env key we are using, you will be able to see 502.
  2. Now change the identifier to any test value and API will work (no 502)

Expected behavior When we are sending the above payload with our env key, we expect it to return 200OK with the right response instead of a 502.

How are you running Flagsmith?

  • SaaS at flagsmith.com

Additional context Discord conversation link - https://discord.com/channels/517647859495993347/917719343930957846/1154656436220076084

About this issue

  • Original URL
  • State: closed
  • Created 9 months ago
  • Comments: 26 (17 by maintainers)

Most upvoted comments

Hi @NilanshBansal Just to add - we’re still actively working on this issue, trying to recreate it and understand how this data got to be in the state that was in. We’re not closing this ticket and will add detail as we find it.

@gagantrivedi Can you please do the same for this identifier as well? 63055b8779f6d5ac6b0a81de378c574e45385903d3a13899a008061d36cc35b2

It is already done for this identity

What was the root cause of this issue?

We are not sure yet because we can’t reproduce this

How can we ensure this issue doesn’t occur for the other identifiers? Are there any measures we can take to avoid this in future?

Not really, no. in fact, I would like you to do whatever you did earlier. See if you can reproduce it?

You mentioned, the char limit is 2000 for a trait, but we sent the instanceId trait with 64 chars, how could that cause this to happen?

That’s the character limit for string we also support other data types

@vivonk we have removed the instaceID trait from 68385f9726ad05c8e551a8d5be5cd8213f1e733346a9eb00e86f83df94639555, you should be able to access it now

@dabeeeenster @khvn26 we are using the Flagsmith Java SDK (v6.1.0). The method being invoked is getIdentityFlags(identifier, traits)

Ref: https://docs.flagsmith.com/clients/server-side#get-flags-for-an-identity
cc: @vivonk

@khvn26 thanks for sharing this. Let me check both things and get back to you by tomorrow morning IST time.