Skip to content

Commit 54fdcd9

Browse files
bchapuisclaude
andcommitted
Add debug logging for subscription plan resolution in triggers
Logs userPlan at three points: billing info query result, runtime init, and subscription check failure. This will show whether the plan is resolved correctly from the DB and whether it survives through to the runtime subscription check. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6dd6115 commit 54fdcd9

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

apps/api/src/db/queries.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2165,7 +2165,11 @@ export async function getOrganizationBillingInfo(
21652165
.limit(1);
21662166

21672167
if (!result) return undefined;
2168-
return { ...result, userPlan: result.userPlan ?? Plan.TRIAL };
2168+
const userPlan = result.userPlan ?? Plan.TRIAL;
2169+
console.log(
2170+
`[BillingInfo] org=${organizationId} subscriptionStatus=${result.subscriptionStatus} userPlan=${userPlan} rawUserPlan=${result.userPlan}`
2171+
);
2172+
return { ...result, userPlan };
21692173
}
21702174

21712175
/**

packages/runtime/src/base-runtime.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ export abstract class Runtime<Env = unknown> {
277277
this.whatsappPhoneNumberId = whatsappPhoneNumberId;
278278

279279
console.log(
280-
`[Runtime] run workflow=${workflow.id} trigger=${workflow.trigger} nodes=${workflow.nodes.length} telegramMessage=${!!telegramMessage} telegramBotToken=${!!telegramBotToken}`
280+
`[Runtime] run workflow=${workflow.id} trigger=${workflow.trigger} nodes=${workflow.nodes.length} userPlan=${userPlan} telegramMessage=${!!telegramMessage} telegramBotToken=${!!telegramBotToken}`
281281
);
282282

283283
// Initialise state and execution record
@@ -809,6 +809,9 @@ export abstract class Runtime<Env = unknown> {
809809
}
810810

811811
if (nodeType.subscription && this.userPlan !== "pro") {
812+
console.log(
813+
`[Runtime] subscription check failed for node=${node.id} type=${node.type} userPlan=${this.userPlan}`
814+
);
812815
return {
813816
nodeId: node.id,
814817
status: "error",

0 commit comments

Comments
 (0)