kingyml
kingyml
CCConvex Community
Created by kingyml on 9/17/2024 in #support-community
Error when using withIndex (Index not found)
Great this worked! My issue was in the schema.ts file. I didn't have it set up correctly. Thank you so much
5 replies
CCConvex Community
Created by kingyml on 9/17/2024 in #support-community
Error when using withIndex (Index not found)
No description
5 replies
CCConvex Community
Created by kingyml on 9/17/2024 in #support-community
Error when using withIndex (Index not found)
Here is the query that's not working
export const getTestItems = query({
args: {
category: v.string(),
},
handler: async (ctx, args) => {
const user = await authenticateUser(ctx);
const { category } = args;

console.log("Querying testItems for user:", user._id, "and category:", category);

const items = await ctx.db
.query("testItems")
.withIndex("by_userId_and_category", (q) =>
q.eq("userId", user._id).eq("category", category)
)
.collect();

console.log("Query result:", items);

return items;
},
});
export const getTestItems = query({
args: {
category: v.string(),
},
handler: async (ctx, args) => {
const user = await authenticateUser(ctx);
const { category } = args;

console.log("Querying testItems for user:", user._id, "and category:", category);

const items = await ctx.db
.query("testItems")
.withIndex("by_userId_and_category", (q) =>
q.eq("userId", user._id).eq("category", category)
)
.collect();

console.log("Query result:", items);

return items;
},
});
this query below works fine
export const getAllTestItems = query({
handler: async (ctx) => {
const user = await authenticateUser(ctx);

console.log("Querying all testItems for user:", user._id);

const items = await ctx.db
.query("testItems")
.filter((q) => q.eq(q.field("userId"), user._id))
.collect();

console.log("Query result:", items);

return items;
},
});
export const getAllTestItems = query({
handler: async (ctx) => {
const user = await authenticateUser(ctx);

console.log("Querying all testItems for user:", user._id);

const items = await ctx.db
.query("testItems")
.filter((q) => q.eq(q.field("userId"), user._id))
.collect();

console.log("Query result:", items);

return items;
},
});
5 replies
CCConvex Community
Created by Riki on 9/11/2024 in #support-community
[React-Native] Custom Auth - JWT refresh issue
Sorry I think I just didn't read the docs, I had to wrap my component with <Authenticated> that seemed to work
16 replies
CCConvex Community
Created by Riki on 9/11/2024 in #support-community
[React-Native] Custom Auth - JWT refresh issue
Hi so I have a similar issue. I am noticing it occurs specifically when I try to call const identity = await ctx.auth.getUserIdentity(); inside of a query like @Riki on their getHomeFeed function. Using const identity = await ctx.auth.getUserIdentity(); in a mutation seems to work fine. I haven't tried it in an action yet. I am running convex version 1.12.1 I am using clerk and clerk is logged in fine and is sending the user Id however convex seems to not agree that the user is signed in but this is only in queries, works fine in mutations.
16 replies
CCConvex Community
Created by kingyml on 7/10/2024 in #support-community
File Bandwith Help
Yes, 1MB/minute mp3 is about right. Looking into it now, I had no idea that’s what it takes to power those apps. I’m still learning so I’m glad you were able to teach me something there. I need to look into all those optimization techniques you mentioned and then I’ll circle back later. Thanks Tom, this was actually really helpful! You motivated me to keep going and optimize it so I can learn all that stuff.
4 replies