ThePndaXpresT
Convex Community17mo ago
3 replies
ThePndaXpres

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);
},
});
Was this page helpful?