Convex CommunityCCConvex Community
Powered by
KennyK
Convex Community•8mo ago•
5 replies
Kenny

convex-swift subscriptions do not work when the convex client is authenticated

I'm experiencing an issue with the ConvexMobile Swift client where subscriptions fail to receive values when authentication is performed before subscription setup. The authentication succeeds, but the underlying Convex functions are never called.

Environment:


ConvexMobile Swift client version: 0.5.5 VersionInfo.swift:3
Authentication provider: Clerk
Platform: iOS
Convex Backend version: 1.24.1

Issue Details:


1. Authentication Flow: Using ConvexClientWithAuth with a custom ClerkProvider that implements the AuthProvider protocol
2. Problem: When I call convexClient.login() before setting up subscriptions, the subscriptions never receive values and the Convex functions are never executed on the backend
3. Current Coordination: I'm monitoring the authState publisher and only setting up subscriptions after receiving .authenticated state

Logs:


UserManager initialized
AuthCheckView task got a clerk.user: nil
AuthCheckView task got a clerk.user: Optional("<redacted>")
UserManager didSet: clerkUser is not nil
isLoadingUser: false
error: nil
currentUser: nil
isCreatingProfile: false
profileCreationError: nil
subscriptionsInitialized: false
cancellables: []
ClerkProvider login: token: 1196
ClerkProvider extractIdToken: 1196
Convex authenticated, setting up subscriptions
UserManager setupUserSubscription: subscribing to user: <redacted>
// nothing afterwards. when i don't log in i see: UserManager setupUserSubscription: received user: //Optional("<redacted>")
UserManager initialized
AuthCheckView task got a clerk.user: nil
AuthCheckView task got a clerk.user: Optional("<redacted>")
UserManager didSet: clerkUser is not nil
isLoadingUser: false
error: nil
currentUser: nil
isCreatingProfile: false
profileCreationError: nil
subscriptionsInitialized: false
cancellables: []
ClerkProvider login: token: 1196
ClerkProvider extractIdToken: 1196
Convex authenticated, setting up subscriptions
UserManager setupUserSubscription: subscribing to user: <redacted>
// nothing afterwards. when i don't log in i see: UserManager setupUserSubscription: received user: //Optional("<redacted>")

Here is a deepwiki link that shows my conversation with devin about the problem: https://deepwiki.com/search/why-would-my-subscriptions-not_17ec9c2a-d968-4acf-9e51-9a78f374cfdc

Would appreciate any help with this, been banging my head against it for a couple days now and happy to provide
message.txt5.63KB
DeepWiki
Search | DeepWiki
DeepWiki provides up-to-date documentation you can talk to, for every repo in the world. Think Deep Research for GitHub - powered by Devin.
Convex Community banner
Convex CommunityJoin
Join the Convex Discord! Explore Convex, the backend platform that keeps your app in sync.
15,138Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements
Recent Announcements
james

Hi @everyone with everything going on today I forgot to post on discord about our EU launch! We have a region in Dublin now! You can start using it immediately, even for folks on the free plan. https://news.convex.dev/we-finally-got-our-eu-visa/ Stay tuned for more regions but also stay tuned for more infra improvements where we improve latency for teams no matter where their servers are located. Just at the tip of the iceberg re all the optimizations we have lined up.

james · 4d ago

Wayne

Hi @everyone happy Monday. Components Authoring [Challenge](https://www.convex.dev/components/challenge) updates! Meet the second batch of community-approved components **Firecrawl Scrape **- Scrape any URL and get clean markdown, HTML, screenshots, or structured JSON - with durable caching and reactive queries. https://www.convex.dev/components/firecrawl-scrape Built by: Gitmaxd **Durable Agents **- A Convex component for building durable AI agents with an async tool loop. https://www.convex.dev/components/durable-agents Built by: Siegfried **Convex Debouncer** - A server-side debouncing component for debouncing expensive operations like LLM calls, metrics computation, or any heavy processing that should only run after a period of inactivity. https://www.convex.dev/components/debouncer Built by: Ilya **DatabaseChat **- A Convex component for adding natural language database queries to your app. https://www.convex.dev/components/database-chat Built by: Nick **Transloadit** - A Convex component for creating Transloadit Assemblies, handling resumable uploads with status, and persisting status/results in Convex. https://www.convex.dev/components/transloadit Built by: Kvz **Loops** - A Convex component for integrating with Loops.so email marketing platform. https://www.convex.dev/components/loops Built by: Bobby The [challenge](https://www.convex.dev/components/challenge) is now ongoing, so keep building, and we'll keep rewarding. Thanks, everyone!

Wayne · 3w ago

Liz C

Hi everyone! Have you ever wanted to get your hands on some convex swag? Well you're in luck! We just launched our Convex swag store. Check it out here ---> https://store.convex.dev/

Liz C · 3w ago

Similar Threads

WorkOS/Convex `Authenticated` component not working
mchisolm0Mmchisolm0 / support-community
3mo ago
convex swift with clerk
Mark12345MMark12345 / support-community
13mo ago
convex-rs client, waiting for auth/checking if authenticated
λx.1Λλx.1 / support-community
7mo ago
convex throws error useres are not getting authenticated
The Black RoseTThe Black Rose / support-community
2y ago