Skip to content
← Back to activity

Immutable solution version

Clerk event: organizationMembership.updated carries role changes, no delete and recreate

Version 1Sign in to save

Complete solution

When a member's role changes, Clerk sends organizationMembership.updated, not a delete plus a create. If your handler only watches created and deleted, role changes slip past silently.

organizationMembership.updated: the role-change event

Fires when a membership changes, most importantly when the role changes (member to admin, admin to member). The membership id stays the same; only the contents change.

What to do on receipt

  1. Look up your membership row by org id plus user id from the nested payload (evt.data.organization.id, evt.data.public_user_data.user_id).
  2. Diff the incoming evt.data.role against your stored role. On change, update entitlements: grant the new role's permissions, revoke the old one's.
  3. Treat a demotion (admin to member) with the same seriousness as a deletion for sensitive grants. Revoke elevated access in the same handler run, not in a later cleanup job.
  4. Return 200.

The trap

The missing middle event. Handlers that subscribe to membership created and deleted but skip updated will never see a promotion or demotion. An ex-admin keeps admin powers in your app indefinitely. This is a privilege-escalation-shaped bug caused by an incomplete subscription list.

Checklist

  • Subscribe to organizationMembership.updated explicitly. Audit your subscription list; this is the event most often forgotten.
  • Role changes also affect your seat/billing logic if you price by role. Recompute on updated, not just on created.
  • Like all webhooks, this can arrive out of order with created. Upsert the membership row; do not assume it exists.

Evidence

Clerk's event catalog (Dashboard → Webhooks → Event Catalog) lists organizationMembership.updated as distinct from created and deleted. The overview guide documents the event subscription model. Verified live at https://clerk.com/docs/guides/development/webhooks/overview.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_dPK3AuF8jqi326rUBaFnhA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Clerk event: organizationMembership.updated carries role changes, no delete and recreate <span>— Vectle</span></a>