Expo Better Auth breaking with any client plugin "better-auth/client/plugins"
I narrowed down the issue to "better-auth/client/plugins", using any client plugin on expo breaks the app and figured out "jose" was the issue
Here's a very basic repo with better auth which has the issue: https://github.com/abhay-ramesh/authTest
❗Someone help me out
Thank You
GitHub
GitHub - abhay-ramesh/authTest
Contribute to abhay-ramesh/authTest development by creating an account on GitHub.

62 Replies
Hey got it narrowed down to v1.1.19, any version before it works, havent tried the beta-versions
@admin 1.1.19 breaks in expo. issue with crypto module

Hey guys, please try
1.1.20-beta.2
and report backGot a different error with
1.1.20-beta.2

is the
auth
import, the server auth instance?Yes ig
btw its this file
ok the prev screenshot is of a different repo,
i created a repo just to test the bug you can use it to test it and even there had the same issue: https://github.com/abhay-ramesh/authTest
its a very plain repo with expo and better-auth btw
1.1.20-beta.2
not working their eitherGitHub
GitHub - abhay-ramesh/authTest
Contribute to abhay-ramesh/authTest development by creating an account on GitHub.

ill try to test from
v1.1.18
till v1.1.19
we might be able to narrow down to figure out which release caused it
v1.1.18
works
v1.1.19-beta.1
works
v1.1.19-beta.2
doesn't work
v1.1.19-beta.3
doesn't work
v1.1.19
doesn't workGitHub
feat(one-tap): improve Google One Tap integration with JWT verific...
…ion and improved prompt handling (#1452)
* fix(auth): use options.baseURL instead of ctx.baseURL on trusted origins
* feat(one-tap): improve Google One Tap integration with JWT verification a...
packages/better-auth/src/plugins/one-tap/index.ts
Usage of "jose" might be the issue "Maybe"
ok i manually removed oneTap
from /node_modules/better-auth/dist/client/plugins.js
and it workedbut jose is imported in the server instance. you sholdn't import the server in your react native code.
if you need the type you should make sure to import it as a type
even if im not importing
import { auth } from "my-config"
have the issueshould be fixed on
1.1.20-beta.3
Hey thanks alot for the help, really love better-auth nice work
this error also occurs with the Polar client integration.
How did you fix this? I am getting the same on 1.3.7

Falling back to 1.3.6 works
Update to 1.3.9 and try this
https://discord.com/channels/1288403910284935179/1413014002056958064/1415046892013879306
with 1.3.9 in production when I trigger any function of authClient, the app will crash
https://github.com/better-auth/better-auth/issues/4471#issuecomment-3285078594
GitHub
React Native build issue on v1.3.8 · Issue #4471 · better-auth/be...
Is this suited for github? Yes, this is suited for github To Reproduce Create a new expo app, install better-auth@1.3.8 and @better-auth/expo@1.3.8, setup according to docs, import a plugin from be...
Do you use expo crypto in your app normally?
I use expo crypto only to fix this error
Cannot read property 'subtle' of undefined
, and i get that error when ever I use a better-auth plugin from client sidedid you install that package?
I am using plugins as well but no issue at all
for sure
"expo-crypto": "^15.0.7"
, I just built another APK with 1.3.6, and it's not sending any request to backend
what plugin did you use?nothing much just email otp and expo client for now
GitHub
React Native build issue on v1.3.8 · Issue #4471 · better-auth/be...
Is this suited for github? Yes, this is suited for github To Reproduce Create a new expo app, install better-auth@1.3.8 and @better-auth/expo@1.3.8, setup according to docs, import a plugin from be...
why don't you try this one?
I did, I'm in that discussion 😅
oh sorry my bad
strange both works for me
which version of better-auth did you use? and also you created that too?
crypto-polyfill.js
If you have some time, I appreciate if you take a look at my code.:
https://github.com/HoshangDEV/expo-better-auth
GitHub
GitHub - HoshangDEV/expo-better-auth
Contribute to HoshangDEV/expo-better-auth development by creating an account on GitHub.
I might be wrong but I think the app is crashing maybe it can't find the file in path ? instead of '@' I used just '../', sounds shit but idk try
I'm gonna try this...
btw did you tried devclient before compiling ?
if you mean if I have tested it locally using
npm start
with Expo Go, yes.did that crash ?
no, locally everything works fine.
well for testing keep using expo go till some proper solutions are out
I just tested that, and when I open the app it will crash immediately, I used
1.3.9
for that one. I'm gonna try 1.3.6
now ...1.3.6 doesn't even need any custom polyfill
before, I built one with
1.3.6
but I hard coded the baseUrl because I want to test the build with local backend, and I was getting throw errors, right now I'm rebuilding it again but with hosted backend. It's really a headache
finally, it did work.1.3.6 just works normally no custom setup needed
too late, I tasted all the pain and headache 😭😂, thank you thou, I appreciate your help.
well my plan was to make everything working with latest version
the latest version works for you?
by both you meant which one?
With custom polyfils
GitHub
React Native build issue on v1.3.8 · Issue #4471 · better-auth/be...
Is this suited for github? Yes, this is suited for github To Reproduce Create a new expo app, install better-auth@1.3.8 and @better-auth/expo@1.3.8, setup according to docs, import a plugin from be...
@SKetU Tried
"better-auth": "1.3.10-beta.4"
and "@better-auth/expo": "1.3.10-beta.4"
, everything works fine!Without any polyfils?
I included it, now let me try without any polyfils...
I built one without polyfils, and when I open it, it gonna crash immediately, so it's not working without polyfils.
Seems like now everyone can use polyfils with new beta
GitHub
React Native build issue on v1.3.8 · Issue #4471 · better-auth/be...
Is this suited for github? Yes, this is suited for github To Reproduce Create a new expo app, install better-auth@1.3.8 and @better-auth/expo@1.3.8, setup according to docs, import a plugin from be...
try the new beta 7 without polyfils
How i can fix it? I am getting the same error on 1.3.9

it's working without polyfils on android
try 1.3.6
I mean 1.3.10 beta 7
yeah, I mean this one too, it's working fine, but haven't tried it yet in an iOS production build
It should now work without polyfils
https://discord.com/channels/1288403910284935179/1413014002056958064/1416707606986358916
did you try with iOS?
Sadly I don't own I phone or mac
1.3.10 works fine on iOS ✅
damn nice, congratulations
yeah, thanks