TypeError: Response body object should not be disturbed or locked
I got this error and have no clue how to resolve it. I use Better auth on my nestJS server, see my implementation :
auth.service.ts
auth.controller.ts
I have used this implementation from another better auth user : https://github.com/danyalutsevich/sandbox/tree/base/js_ts/admin/src/modules/better-auth
Using better-auth expo client on a react-native app.
Thanks in advance !
GitHub
sandbox/js_ts/admin/src/modules/better-auth at base ยท danyalutsevic...
Only I understand what is going on here. You don't need to - danyalutsevich/sandbox

12 Replies
this means the body is getting parsed by nest js before it reaches better auth hanlder. not familiar with nest but basically you need to prevent the body from being pre-parsed
Ok i will investigate, thanks you !
Worked like a charm, thanks you so much
Just have to disable bodyParser, globally or on a specific root with middleware.
If you need documentation or source code on nestJS implementation, i can provide you some stuff as much as i can ๐
yeah please do. would apperciate that. we don't have a documentation for nest js yet
Okay i will start to document my implementation ๐
Unknown Userโข3mo ago
Message Not Public
Sign In & Join Server To View
Hi ! Working on it, i keep you in touch soon
For now, do you want my repo ?
Unknown Userโข3mo ago
Message Not Public
Sign In & Join Server To View
Im returning from vacation, sending you this asap ๐
here it is : https://github.com/Gaetandrt/nestjs-better-auth-exemple
@Tivot @David (zyzer) ๐
I have setup better-auth and its working but i have not experience it a lot for now. There maybe is a better way to do it.
Don't forget to disable bodyParser. I have done it globally as a work around but if you find a way to disable it only for the better auth root, its better.
Unknown Userโข3mo ago
Message Not Public
Sign In & Join Server To View
Nice workaround for the bodyParser, for the decorator and session i didn't investigate more than the stup for now so i can't help you here
Unknown Userโข3mo ago
Message Not Public
Sign In & Join Server To View
Keep me in touch if you find workaround / tips for the nestJS implementation as i'm writting the doc