ŠtosdenferŠ
Convex Community7mo ago
15 replies
Štosdenfer

import.meta not supported - calling helper fn

I'm getting
import.meta not supported
error when trying to run this:

// convex/tasks.ts
export const deleteTask = mutation({
  args: {
    id: v.id("tasks"),
    fileKeys: v.array(v.string()),
  },
  handler: async (ctx, args) => {
    const user = await ctx.auth.getUserIdentity();
    if (!user) {
      throw new Error("not-authorized");
    }

    await ctx.db.delete(args.id);
    await deleteFiles(args.fileKeys);
  },
});

// server/uploadthing.ts
"use server";

import { UTApi } from "uploadthing/server";

const utapi = new UTApi({});

export const deleteFiles = async (fileKeys: string[]) => {
  await utapi.deleteFiles(fileKeys);
};


If I remove line
await deleteFiles(args.fileKeys);
in
convex/tasks.ts
everything works. Can I not call outside fns inside mutations?
Was this page helpful?