ThePndaXpres
CCConvex Community
•Created by ThePndaXpres on 9/14/2024 in #support-community
Convex react client requires url
I am getting this error message: Uncaught Error: ConvexReactClient requires a URL like 'https://happy-otter-123.convex.cloud'.
This error shows up when I deploy to Vercel but does not show up on local.
2 replies
CCConvex Community
•Created by ThePndaXpres on 9/14/2024 in #support-community
arg validation error
There seems to be a mismatch between my argument and the validation structure I have setup. I am not sure what the difference is though there is the error:
Value: "{"title":"Test Form!","questions":[{"question_text":"Name:","question_type":"text"},{"question_text":"Date:","question_type":"date"},{"question_text":"Favorite Animal","question_type":"multiple_choice","answer_choices":["Dog","Bird","Cat"]}]}"
Validator: v.object({questions: v.array(v.object({answer_choices: v.optional(v.array(v.string())), question_text: v.string(), question_type: v.string()})), title: v.string()})
Here is my code:
args: {
jsonSchema: v.object({
name: v.string(),
arguments: v.object({
title: v.string(),
questions: v.array(
v.object({
question_text: v.string(),
question_type: v.string(),
answer_choices: v.optional(v.array(v.string())),
})
),
}),
id: v.string(),
}),
},
Here is the argument passed in:
{
name: 'get_form_fields',
arguments: '{"title":"Test Form!","questions":[{"question_text":"Name:","question_type":"text"},{"question_text":"Date:","question_type":"date"},{"question_text":"Favorite Animal","question_type":"multiple_choice","answer_choices":["Dog","Bird","Cat"]}]}',
id: 'jd75rcvn2prw660as04ak1qzf970rrpd'
}
4 replies
CCConvex Community
•Created by ThePndaXpres on 9/14/2024 in #support-community
ctx.db.insert not returning id
SOLVED
I am trying to insert a field and it is not returning the id. It is instead returning 'finished'
Here is my code:
export const populateData = internalMutation({
args: { jsonSchema: v.json() },
handler: async (ctx, args) => {
const idOut = await ctx.db.insert("forms", {
name: args.jsonSchema.name,
schema: args.jsonSchema.arguments,
});
console.log(idOut);
return idOut;
},
});
1 replies
CCConvex Community
•Created by ThePndaXpres on 9/14/2024 in #support-community
ctx.db undefined
I am trying to use .get to get an entry by its id but I am getting the error Server Error
Uncaught TypeError: Cannot read properties of undefined (reading 'get')
Here is my code snippet:
export const chat = action({
args: {
imageId: v.string(),
},
handler: async (ctx, args) => {
console.log(args.imageId);
const document = await ctx.db.get(args.imageId);
return await ctx.storage.getUrl(document.body);
},
});
4 replies