amppA
Convex Community2y ago
2 replies
ampp

Uncaught Error: System tables can only be accessed from db.system.normalizeId(). with Ent

I have listScheduledFunctions with table _scheduled_functions that works great, but getScheduledMessage gives that error.

export const listScheduledFunctions = query({
    args: { 
      paginationOpts: paginationOptsValidator,
    },
    handler: async (ctx, args) => 
    {   
      await hasAdminRole(ctx);

      return await ctx.table.system("_scheduled_functions").order("desc").paginate(args.paginationOpts);
    },
  });
  
export const getScheduledMessage = query({
args: {
    id: v.id("_scheduled_functions"),
},
handler: async (ctx, args) => {
    return await ctx.table.system("_scheduled_functions").get(args.id);
},
});

I tried to change .get to .normalizeId but no luck with that. The same error. Any ideas. I did check to maek sure my query is being called from functions.ts etc..
Was this page helpful?