Database Hooks `before.create` Has Undefined Context
How is the context populated in the database before create hook?
Taken from example here https://www.better-auth.com/docs/concepts/database#1-before-hook
Code snippet below:
Database | Better Auth
Learn how to use a database with Better Auth.
5 Replies
It depends on how a given session was created, in some cases there can be no ctx.
Yeah I see the parameter type as
GenericEndpointContext | undefined
. I'm trying to get the context during signup with oauth in the /callback/:id
path.I see, I'll look into the source code and see if I can add ctx.
Sounds good, thank you.
chiming in here, as I have a similar issue: i'm trying to access the
context
object and use internalAdapter.deleteSessions
to manually revoke other session. But context
is always coming back as null.
code for reference: