flagsmith icon indicating copy to clipboard operation
flagsmith copied to clipboard

AttributeError: 'APIKeyUser' object has no attribute 'id'

Open sentry[bot] opened this issue 1 year ago • 1 comments

Sentry Issue: FLAGSMITH-API-4S6

AttributeError: 'APIKeyUser' object has no attribute 'id'
(6 additional frame(s) were not displayed)
...
  File "edge_api/identities/serializers.py", line 192, in save
    "changed_by_user_id": request.user.id,

sentry[bot] avatar Aug 29 '24 07:08 sentry[bot]

This is actually a bit messy to solve since it will break the webhook schema. As you can see here, we are currently always sending the email of the user that made the change. By updating this logic to support API keys, we'll no longer be able to support this.

This will need some thought about e.g. whether we need to version the webhook, etc.

matthewelwell avatar Aug 29 '24 07:08 matthewelwell

The docs make it look like that changed_by is First Name and Last Name https://docs.flagsmith.com/system-administration/webhooks

gagantrivedi avatar Aug 30 '24 04:08 gagantrivedi

Add we return "" for changed_by(using master api Key) for other feature state webhook triggers(i.e: not for edge identity). I'd say either return the name of the master api_key here or add another field for changed_by for master api key

gagantrivedi avatar Aug 30 '24 05:08 gagantrivedi