TotallyDark
TotallyDark8mo ago

How do I use internal mutations?

I am trying to upload generated images to Convex DB and following this Convex tutorial: https://docs.convex.dev/file-storage/store-files. However I am getting this error when I try to call the mutation, any pointers?: (Attached Schema and Error) Property 'TodayLunchPhoto' does not exist on type '{ upload: { saveStorageId: FunctionReference<"mutation", "internal", { storageId: Id<"_storage">; }, -1 | null>; }; }'
No description
No description
1 Reply
erquhart
erquhart8mo ago
You'll want to use the path to the file that holds the query, not the table name. So for example, if your saveStorageId internal mutation is defined in convex/todayLunch.ts, you'll reference the mutation as:
useMutation(internal.todayLunch.saveStorageId)
useMutation(internal.todayLunch.saveStorageId)
You can read the docs on how query/mutation names work here: https://docs.convex.dev/functions/query-functions#query-names

Did you find this page helpful?