[GH-ISSUE #4766] Database hook delete #10054

Closed
opened 2026-04-13 05:57:33 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @benjaminpreiss on GitHub (Sep 19, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/4766

Originally assigned to: @Kinfe123 on GitHub.

Is this suited for github?

  • Yes, this is suited for github

I am building an integration of better-auth into payload. This works by letting better-auth handle the session and syncing the users from better-auth to payload (upon create and delete).

Describe the solution you'd like

For the sync I am using database hooks, as I thought this to be the most robust approach as it is not bypassable. Turns out that database hooks don't support delete, only create and update?

It would be great to have a delete hook available as well

Describe alternatives you've considered

I could instead use regular hooks, but I was afraid it might not be as robust as database hooks / that there might be ways that someone interacting with my better-auth instance might bypass the hooks. Curious what you think though.

Additional context

No response

Originally created by @benjaminpreiss on GitHub (Sep 19, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/4766 Originally assigned to: @Kinfe123 on GitHub. ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. I am building an integration of better-auth into payload. This works by letting better-auth handle the session and syncing the users from better-auth to payload (upon create and delete). ### Describe the solution you'd like For the sync I am using database hooks, as I thought this to be the most robust approach as it is not bypassable. Turns out that database hooks don't support delete, only create and update? It would be great to have a delete hook available as well ### Describe alternatives you've considered I could instead use regular hooks, but I was afraid it might not be as robust as database hooks / that there might be ways that someone interacting with my better-auth instance might bypass the hooks. Curious what you think though. ### Additional context _No response_
GiteaMirror added the help wantedenhancementlocked labels 2026-04-13 05:57:34 -05:00
Author
Owner

@himself65 commented on GitHub (Sep 19, 2025):

I think the feature makes sense. I'm +1 on this. What do you think @Bekacru

<!-- gh-comment-id:3313571238 --> @himself65 commented on GitHub (Sep 19, 2025): I think the feature makes sense. I'm +1 on this. What do you think @Bekacru
Author
Owner

@Bekacru commented on GitHub (Sep 19, 2025):

yeah we should have delete hooks

<!-- gh-comment-id:3313581216 --> @Bekacru commented on GitHub (Sep 19, 2025): yeah we should have delete hooks
Author
Owner

@gregoiregentil commented on GitHub (Sep 22, 2025):

I need to do the same ideally in the database hook. As a temporary solution, can anyone post a robust hook to catch the delete user scenario?

<!-- gh-comment-id:3317253833 --> @gregoiregentil commented on GitHub (Sep 22, 2025): I need to do the same ideally in the database hook. As a temporary solution, can anyone post a robust hook to catch the delete user scenario?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#10054