Abhishek
Abhishek9mo ago

internal action not showing arguments

I am passing my args from an action to an internal action but the console logging args in internal action the args are coming up empty
export const postOnLinkedIn = action({
args: {
campaignId: v.string(),
},
async handler(ctx, args) {
const identity = await ctx.auth.getUserIdentity();
// if (!identity) {
// throw new Error("Unauthenticated call to mutation");
// }
await ctx.scheduler.runAfter(0, internal.linkedin.internalPostOnLinkedIn, {
userToken:
"test",
campaignId: "test",
});
},
});

export const internalPostOnLinkedIn = internalAction({
args: {
userToken: v.string(),
campaignId: v.string(),
},
handler: async (ctx, args) => {
console.log("Auth token", args.userToken);
console.log("Campaign ID", args.campaignId);
}})
export const postOnLinkedIn = action({
args: {
campaignId: v.string(),
},
async handler(ctx, args) {
const identity = await ctx.auth.getUserIdentity();
// if (!identity) {
// throw new Error("Unauthenticated call to mutation");
// }
await ctx.scheduler.runAfter(0, internal.linkedin.internalPostOnLinkedIn, {
userToken:
"test",
campaignId: "test",
});
},
});

export const internalPostOnLinkedIn = internalAction({
args: {
userToken: v.string(),
campaignId: v.string(),
},
handler: async (ctx, args) => {
console.log("Auth token", args.userToken);
console.log("Campaign ID", args.campaignId);
}})
No description
8 Replies
erquhart
erquhart9mo ago
It looks like you're calling the internal action directly in the dashboard, and you're passing in empty strings as args Did you mean to call postOnLinkedIn in the dashboard?
Abhishek
AbhishekOP9mo ago
Currently im hard coding it and sending it @erquhart
await ctx.scheduler.runAfter(0, internal.linkedin.internalPostOnLinkedIn, {
userToken:
"test",
campaignId: "test",
});
},
await ctx.scheduler.runAfter(0, internal.linkedin.internalPostOnLinkedIn, {
userToken:
"test",
campaignId: "test",
});
},
erquhart
erquhart9mo ago
The screen grab looks like you're running it in the dashboard
Abhishek
AbhishekOP9mo ago
yes testing it in dashboard
erquhart
erquhart9mo ago
You're running the internal action directly and you're passing it empty strings you need to run postOnLinkedIn to test the function you're referring to in your OP
Abhishek
AbhishekOP9mo ago
Ohh thankss silly mistake , this is so embarrassing but thanks a lot @erquhart
erquhart
erquhart9mo ago
nah, just need a second set of eyes sometimes also note that when you run that other function, I don't think the scheduled function logs will show up in the action logs, you'll need to head over to the logs view to see them (pretty sure)
Abhishek
AbhishekOP9mo ago
Yeah i figured it just now thnaks a lot

Did you find this page helpful?