The user data ID is empty in the before hook of the database.
Is this phenomenon normal in this hook? Because when checking the TypeScript type definitions, it is certain that there will be an id.
4 Replies
In what hook? Can you provide some details e.g. code of what you are trying to do?
before hook,I need to call a third-party service before the user is written to the database, this service needs to correspond to my user one by one, if the service call fails then the user needs to fail to be created as well, so I need the id of the user, but the id I get from the user is undefined
https://github.com/better-auth/better-auth/issues/1060 looks like it isn't possible to get the user's id in the before hook of the users model.
Okay, thank you