mapWith not getting called on extras

Hi
const users = await db.query.users.findMany({
  limit: 5,
  columns: {
    id: true,
    givenName: true,
    familyName: true,
  },
  extras: (user) => ({
    imageUrl: sql`${db
      .select({ id: userImages.fileId })
      .from(userImages)
      .where(eq(userImages.userId, user.id))
      .limit(1)}`
      .mapWith((x) => (x ? getUploadUrl(x) : null)) // I'm not getting called :(
      .as("imageUrl"),
  }),
})

console.log(users)
Was this page helpful?