Sronds
Sronds
CCConvex Community
Created by Sronds on 11/26/2024 in #support-community
How can i add phone auth to an existing user with Convex Auth
I have a user who's signed up and I want to enable them the ability to also sign in with their phone number. Most of the documentation shows showing either logging in with phone or with email but not both. It seems like there is a shouldLinkViaPhone and shouldLinkViaEmail in the createAccount function but i'm not sure how to implement it. Also is there a way to store the phone number without verifying it? Say we only want to verify (with phone) our Users in the US rather than all of them. At first glance, it seems like i'd have to create a separate user_profile table but i wonder if there's a way to do this directly in the existing auth tables. cc @sshader
1 replies
CCConvex Community
Created by Sronds on 11/18/2024 in #support-community
help me setup a cronjob that loops through my entire user table and updates a number
currently the following code errors out because i have more than 4096 user rows
export const replenishPointsForAllUsers = internalMutation({
args: {},
handler: async (ctx) => {
const userQuery = ctx.db.query('user')

for await (const user of userQuery) {
await ctx.db.patch(user._id, {
points: 100,
})
}
},
})
export const replenishPointsForAllUsers = internalMutation({
args: {},
handler: async (ctx) => {
const userQuery = ctx.db.query('user')

for await (const user of userQuery) {
await ctx.db.patch(user._id, {
points: 100,
})
}
},
})
doesn't seem like indexes would help so not sure how to solve this. i know i should batch the queries but not sure how to do it here is the specific error i'm getting
Uncaught Error: Too many reads in a single function execution (limit: 4096). Consider using smaller limits in your queries, paginating your queries, or using indexed queries with a selective index range expressions.
Uncaught Error: Too many reads in a single function execution (limit: 4096). Consider using smaller limits in your queries, paginating your queries, or using indexed queries with a selective index range expressions.
3 replies