#"getManyViaOrThrow" Convex Helper Function Expects 6 Arguments

4 messages · Page 1 of 1 (latest)

pseudo lava
#

Relevant Schema:

  users: defineTable({
    name: v.optional(v.string()),
    image: v.optional(v.string()),
    email: v.optional(v.string()),
    emailVerificationTime: v.optional(v.number()),
    phone: v.optional(v.string()),
    phoneVerificationTime: v.optional(v.number()),
    isAnonymous: v.optional(v.boolean()),
  }).index("email", ["email"]),
  boards: defineTable({
    title: v.string(),
  }),
  userBoards: defineTable({
    userId: v.id("users"),
    boardId: v.id("boards"),
  })
    .index("userId", ["userId"])
    .index("boardId", ["boardId"]),

Mutation:

export const getUserBoards = query({
  args: {},
  handler: async (ctx) => {
    const userId = await getAuthUserId(ctx);
    if (!userId) {
      throw new Error("Not authenticated");
    }

    const boards = await getManyViaOrThrow(ctx.db, "userBoards", "boardId", "userId", userId);
    return boards;
  },
});

Error:

Expected 6 arguments, but got 5.ts(2554)
relationships.d.ts(157, 618): Arguments for the rest parameter 'fieldArg' were not provided.

I have thoroughly read the "Database Relationships Helpers" article:
https://stack.convex.dev/functional-relationships-helpers
But I can't find an example where he uses 6 arguments, nor can I find any examples or documentation that lists the 6 required arguments.

Traverse database relationships in a readable, predictable, and debuggable way. Support for one-to-one, one-to-many, and many-to-many via utility func...

spare spindleBOT
#

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](https://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!
pseudo lava
#

I restarted the editor and the problem magically resolved itself. It seems that the 6th "required" argument "fieldArg" was a hallucination.

old wing