style
style10h ago

using functions from betterAuth component

Hi, I'm trying to get user on server.I cannot follow normal path with getUserIdentity as I use it in cronjob. How do i use function from different component or how do i query table in different component? I've tried importing it's generated api but it's not working:
smsyjyazn3s7vmadb:' [Error: Could not find public function for 'adapter:findOne'. Did you forget to run `npx convex dev` or `npx convex deploy`?]
smsyjyazn3s7vmadb:' [Error: Could not find public function for 'adapter:findOne'. Did you forget to run `npx convex dev` or `npx convex deploy`?]
code:
import { api } from '../betterAuth/_generated/api'

/**
* Get user info by userId (internal query)
*/
export const _internalGetUserInfo = internalQuery({
args: {
userId: v.string(),
},
returns: v.union(
v.object({
email: v.string(),
name: v.string(),
}),
v.null(),
),
handler: async (ctx, args) => {
try {
// Use the adapter's findOne to query the better-auth user table
// This works without authentication since we're querying directly
const user = await ctx.runQuery(api.adapter.findOne, {
model: 'user',
where: [
{
field: 'id',
operator: 'eq',
value: args.userId,
},
],
})
import { api } from '../betterAuth/_generated/api'

/**
* Get user info by userId (internal query)
*/
export const _internalGetUserInfo = internalQuery({
args: {
userId: v.string(),
},
returns: v.union(
v.object({
email: v.string(),
name: v.string(),
}),
v.null(),
),
handler: async (ctx, args) => {
try {
// Use the adapter's findOne to query the better-auth user table
// This works without authentication since we're querying directly
const user = await ctx.runQuery(api.adapter.findOne, {
model: 'user',
where: [
{
field: 'id',
operator: 'eq',
value: args.userId,
},
],
})
1 Reply
Convex Bot
Convex Bot10h ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!

Did you find this page helpful?