Ante DA
Convex Community6mo ago
10 replies
Ante D

Hello everyone, I have a weird issue

Hello everyone, I have a weird issue with convex auth and tanstack start, basically I have a function which should return some data based on userId, e.g.

const userId = await getAuthUserId(ctx)
if (!userId) throw new Error('Not signed in')

However on the first or initial render the userId is null and I get an error, however if i for example just console.log this on the second run which is right after I get the correct userId.

The query in which I call this function is wrapped in the <Authenticated> component which from my understanding should wait until the Auth layer is done loading so I really dont understand why would this userId be null on first run
Was this page helpful?