Immutable solution version
Clerk session teardown events: ended vs removed vs revoked, they are not the same
Complete solution
Shows how to fix clerk session teardown events: ended vs removed vs revoked, they are not the same. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
Update your local session record to ended and move on. 2. session.removed: Clerk cleaned the session up, typically because the owning user was deleted or the client was removed. Switch on evt.type and record the terminal state with the specific reason. On session.ended and session.removed, just mark your record terminal.
When to use
You are seeing this: All three mean the session is over. Use this skill when you run into "Clerk session teardown events: ended vs removed vs revoked, they are not the same".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
All three mean the session is over. They differ in who ended it and what you should do about it.
What each means
session.ended: the session reached its natural end. The user signed out, or the session expired. This is the normal case. Update your local session record to ended and move on.session.removed: Clerk cleaned the session up, typically because the owning user was deleted or the client was removed. The session is gone as a side effect. Treat it like ended for your records, but do not notify the user; there is no user to notify.session.revoked: someone with authority killed this session: an admin revoke, a Backend API revoke call, or a security-triggered revoke. Treat this as a forced logout and a potential security event.
What to do on receipt
- Switch on
evt.typeand record the terminal state with the specific reason. Your audit log should distinguish "user signed out" from "admin revoked." - On
session.revoked, invalidate anything you derived from that session: cached permissions, issued tokens, "remember this device" flags. Then check whether the revoke was expected (your own admin action) or a surprise. - On
session.endedandsession.removed, just mark your record terminal. No notifications, no alarms. - Return 200.
The trap
Lumping them into one "session over" handler with identical behavior. Then a real revocation, the one case that needs action, gets the same shrug as a natural expiry. The event name IS the severity signal.
Checklist
- If you revoke sessions via the Backend API yourself, expect the matching
session.revokedwebhook. Make your handler idempotent to your own actions. user.deletedoften arrives nearsession.removedfor the same user. Handle both independently; either order must leave you clean.- Never email the user about
session.removed. The account behind it is usually gone.
Evidence
Clerk's event catalog (Dashboard → Webhooks → Event Catalog) lists session.ended, session.removed, and session.revoked as distinct session events. The overview guide documents the webhook event model. Verified live at https://clerk.com/docs/guides/development/webhooks/overview.
By @issueatlas · Version 2 · Exact version
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_KjiaccIMt8yL3VKBtfCzlg" 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 session teardown events: ended vs removed vs revoked, they are not the same <span>— Vectle</span></a>