oscklm
oscklm4mo ago

[ConvexAuth] stuck on auth loading & websocket reconnect

Hello, We are experiencing some issues with the @convex-dev/auth library it seems We are using these versions of the related packages: @convex-dev/auth@0.0.65 convex@1.15.0 When we sign in or sign up a user, the useConvexAuth() doesnt pickup the change it seems, and we are stuck with a isLoading being true and get the WebSocket reconnect logged in console below, until we use signOut() from useAuthActions()`
Attempting reconnect in 146.84511437432195ms
LOG WebSocket reconnected
LOG Attempting reconnect in 274.0716054331094ms
LOG WebSocket reconnected
LOG Attempting reconnect in 519.5632832559711ms
LOG WebSocket reconnected
Attempting reconnect in 146.84511437432195ms
LOG WebSocket reconnected
LOG Attempting reconnect in 274.0716054331094ms
LOG WebSocket reconnected
LOG Attempting reconnect in 519.5632832559711ms
LOG WebSocket reconnected
We've made a repro available here, which isolates the issue: https://github.com/oscklm/flimmer-auth-issue We've troubleshooted and tried a bunch of different approaches: - yarn clean cache, remove node_modules, delete yarn lock - we tried setting up a repro, and removing pretty much everything but auth
8 Replies
djbalin
djbalin4mo ago
Colleague following up: Strangely enough, in our main repo (i.e. not the reproduction linked to above), one of our Convex development deployments does not experience this problem: it "only" occurs on the other development deployment as well as on our production deployment. We have verified this by starting a dev server in the exact same repo and only changing our environment variables. We have made sure that both deployments have the same Convex env variables etc., and convex dev parses schema etc. without issues on both deployments.
sshader
sshader4mo ago
Thanks for the context -- if you have a repro handy, if you could turn on verbose logging (new ConvexReactClient(URL, { verbose: true })) and grab the console logs, that can also be helpful.
djbalin
djbalin4mo ago
Thanks @sshader . I don't see the logs anywhere though, neither in the frontend console, our yarn convex dev console nor in the convex dashboard logs. Maybe this is useful: I get the following warning when spinning up my app. I noticed this thing earlier as well, seems like useAuthActions is sometimes imported from import { useAuthActions } from "@convex-dev/auth/dist/react"; and othertimes from import { useAuthActions } from "@convex-dev/auth/react"; (without dist). Not sure if this has any effect? Auth works fine in the one deployment as described above, despite this warning being there as well, so guess maybe not
warning: Attempted to import the [...]\node_modules\@convex-dev\auth\dist\react" which is not listed in the "exports" of "[...]\node_modules\@convex-dev\auth" under the requested subpath "./dist/react". Falling back to file-based resolution. Consider updating the call site or asking the package maintainer(s) to expose this API.
warning: Attempted to import the [...]\node_modules\@convex-dev\auth\dist\react" which is not listed in the "exports" of "[...]\node_modules\@convex-dev\auth" under the requested subpath "./dist/react". Falling back to file-based resolution. Consider updating the call site or asking the package maintainer(s) to expose this API.
oscklm
oscklmOP4mo ago
The verbose: true seems to not log out anything different In regards to the whole import from dist vs not from dist. I did already try making sure nothing was imported from dist, and had no effect on the issue for me.
oscklm
oscklmOP4mo ago
The repro is available here btw. In case you or someone from the team have the chance to take a look. It's possible to just run the expo web app after running yarn dev and hitting w and the there is a super minimal example of the issue happening, the websocket errors we experience above can be seen in the browser console. https://github.com/oscklm/flimmer-auth-issue
GitHub
GitHub - oscklm/flimmer-auth-issue
Contribute to oscklm/flimmer-auth-issue development by creating an account on GitHub.
oscklm
oscklmOP4mo ago
The issue is resolved! This issue was caused by the http.ts missing in our convex folder... Stupid mistake. Very much a big learning lesson for us. But we recently migrated away from a monorepo setup, and to a more simple repo and moved to using expo web etc. In hinsight, we should've been more causious when moving over everything... We tried everything, but looking at if we were missing any config files for the auth implementation. We are still not able to demystify one of the dev deployments still working, even being deployed with the exact same convex backend code, schema and everything. But that i guess we wont find out why anytime soon.
sshader
sshader4mo ago
Ah glad you figured this out -- missing http.ts file makes sense. Will work on having some better error messages + trouble shooting steps here.
oscklm
oscklmOP4mo ago
Thanks. That sounds great, im sure it would help out some people ending up in the same situation.

Did you find this page helpful?