Reference
Remy Reference/agent/auth.userId
?

auth.userId

The current user's id (their row in the user table), or null when the request is unauthenticated.
auth.userId → string | null

The signed-in user's id, a row in the app's user table, or null if the request carries no session, since a method can be reached without one. Guard against null before using it in a query. Checking it for null is how you require a login without touching roles, which are a separate, finer-grained check.

Read current user
const user = auth.userId ? await Users.get(auth.userId) : null;