KenykaK
Convex Community16mo ago
24 replies
Kenyka

invalid args for renaming a file

when calling a function to rename a file, it says that the arguments are invalid, although I specified everything that is needed

await renameFile({
            fileId: file.fileId,
            name: values.title,
          })


export const renameFile = mutation({
    args: { 
        fileId: v.id("files"),
        name: v.string()
    },
    async handler(ctx, args){
        const access = await hasAccessToFile(ctx, args.fileId)

        if(!access){
            throw new ConvexError("no access to file")
        }

        await ctx.db.patch(args.fileId, {
            name: args.name
        })
        
    }
})
image.png
image.png
image.png
Was this page helpful?