Kıte
Kıte14mo ago

WebSocket Port

I tried to connect Convex in expo with Clerk and expo-route, after I put auth.config.ts I got websocket error.
No description
18 Replies
ian
ian14mo ago
Make sure the file is auth.config.js as in the docs (not .ts)
Kıte
KıteOP14mo ago
I tried
.js
.js
at first but I having these error.
No description
Kıte
KıteOP14mo ago
import Constants from "expo-constants";
export default {
providers: [
{
domain: Constants.expoConfig.extra.convexclienturl,
applicationID: "convex",
},
]
};
import Constants from "expo-constants";
export default {
providers: [
{
domain: Constants.expoConfig.extra.convexclienturl,
applicationID: "convex",
},
]
};
This is my line of codes I fixed this, by removing the Constants import. but I'm still having the websocket issue.
jamwt
jamwt14mo ago
ios?
Kıte
KıteOP14mo ago
android
jamwt
jamwt14mo ago
ah. which browser? wait, sorry. expo gotcha yeah, possible this is a real issue. @sshader do you know if we've put much time into the android side of things? I know we've checked out expo on ios quite a bit. dunno if it's possible the websocket lib on expo android is unhappy with something we're doing
Kıte
KıteOP14mo ago
"dependencies": {
"@clerk/clerk-expo": "^0.19.17",
"convex": "^1.5.1",
"expo-router": "^2.0.0",
}
"dependencies": {
"@clerk/clerk-expo": "^0.19.17",
"convex": "^1.5.1",
"expo-router": "^2.0.0",
}
ballingt
ballingt14mo ago
@Kıte What's the error you're seeing now, is it still "No auth provider found matching the given token?" Constants.expoConfig.extra.convexclienturl doesn't sound like the right value here, what do you have for this value now? it ought to be something like "https://big-caiman-52.clerk.accounts.dev/"
Kıte
KıteOP14mo ago
I done that already, still getting the error.
ballingt
ballingt14mo ago
What's the error you're getting now?
Kıte
KıteOP14mo ago
still getting this.
No description
Kıte
KıteOP14mo ago
I'm using react-clerk as a provider
ballingt
ballingt14mo ago
@Kıte sorry for the delay here, could you chevk how you configured this application in Clerk to see if it's using the Convex JWT template?
Kıte
KıteOP14mo ago
Its seems the websocket is gone, after deleting convex jwt and creating a new one, But still can't log in, I'll try to figuring it out first.
ballingt
ballingt14mo ago
This sounds frustrating. Do you know if using Convex without auth works? You might try deleting auth.config.js and removing the Clerk provider and ConvexClerkProvider and get things working without auth (just ConvexProvider) because if it really is a websocket issue auth shouldn't be involved. If using Convex normally without auth works, then we know it's an auth issue and you could retrace the auth setup steps.
Kıte
KıteOP14mo ago
I can login using clerk only I mean I can login with Plain Convex provider.
{"status":400,"clerkError":true,"errors":[{"code":"session_exists","message":"Session already exists","longMessage":"You're currently in single session mode. You can only be signed into one account at a time.","meta":{}}]}
{"status":400,"clerkError":true,"errors":[{"code":"session_exists","message":"Session already exists","longMessage":"You're currently in single session mode. You can only be signed into one account at a time.","meta":{}}]}
Seems like I already logged in but the isAuthenticated is still in false state.
const InitialLayout = () => {
const { isLoading, isAuthenticated } = useConvexAuth()
/// const {isLoaded, isSignedIn} = useAuth()
const segment = useSegments()
const router = useRouter()
useEffect(() => {
if (!isLoading) return
const isTabGroup = segment[0] === '(main)'
if (isAuthenticated && !isTabGroup) {
router.replace("/home")
} else if (!isAuthenticated) {
router.replace("/signin")
}

console.log('isSignedIn:', isAuthenticated)
}, [isAuthenticated])

return <Slot />
}
const InitialLayout = () => {
const { isLoading, isAuthenticated } = useConvexAuth()
/// const {isLoaded, isSignedIn} = useAuth()
const segment = useSegments()
const router = useRouter()
useEffect(() => {
if (!isLoading) return
const isTabGroup = segment[0] === '(main)'
if (isAuthenticated && !isTabGroup) {
router.replace("/home")
} else if (!isAuthenticated) {
router.replace("/signin")
}

console.log('isSignedIn:', isAuthenticated)
}, [isAuthenticated])

return <Slot />
}
ian
ian13mo ago
during development I've run into an issue that was only resolved by clearing cookies & local storage then logging in again. some internal clerk inconsistency I think

Did you find this page helpful?