Skip to content

Commit 0a86eda

Browse files
Revert "feat(enterprise-plan-webhooks): skip webhook queue for enterprise plan users (#1250)" (#1257)
This reverts commit 37dcde2.
1 parent ab71fcf commit 0a86eda

File tree

1 file changed

+4
-9
lines changed
  • apps/sim/app/api/webhooks/trigger/[path]

1 file changed

+4
-9
lines changed

apps/sim/app/api/webhooks/trigger/[path]/route.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,11 @@ export async function POST(
248248
}
249249

250250
// --- PHASE 3: Rate limiting for webhook execution ---
251-
let isEnterprise = false
252251
try {
253252
// Get user subscription for rate limiting (checks both personal and org subscriptions)
254253
const userSubscription = await getHighestPrioritySubscription(foundWorkflow.userId)
255254

256-
const subscriptionPlan = (userSubscription?.plan || 'free') as SubscriptionPlan
257-
isEnterprise = subscriptionPlan === 'enterprise'
255+
const subscriptionPlan = (subscriptionRecord?.plan || 'free') as SubscriptionPlan
258256

259257
// Check async rate limits (webhooks are processed asynchronously)
260258
const rateLimiter = new RateLimiter()
@@ -332,7 +330,7 @@ export async function POST(
332330
// Continue processing - better to risk usage limit bypass than fail webhook
333331
}
334332

335-
// --- PHASE 5: Queue webhook execution (trigger.dev or direct based on plan/env) ---
333+
// --- PHASE 5: Queue webhook execution (trigger.dev or direct based on env) ---
336334
try {
337335
const payload = {
338336
webhookId: foundWebhook.id,
@@ -345,9 +343,7 @@ export async function POST(
345343
blockId: foundWebhook.blockId,
346344
}
347345

348-
// Enterprise users always execute directly, others check TRIGGER_DEV_ENABLED env
349-
// Note: isEnterprise was already determined during rate limiting phase
350-
const useTrigger = !isEnterprise && isTruthy(env.TRIGGER_DEV_ENABLED)
346+
const useTrigger = isTruthy(env.TRIGGER_DEV_ENABLED)
351347

352348
if (useTrigger) {
353349
const handle = await tasks.trigger('webhook-execution', payload)
@@ -359,9 +355,8 @@ export async function POST(
359355
void executeWebhookJob(payload).catch((error) => {
360356
logger.error(`[${requestId}] Direct webhook execution failed`, error)
361357
})
362-
const reason = isEnterprise ? 'Enterprise plan' : 'Trigger.dev disabled'
363358
logger.info(
364-
`[${requestId}] Queued direct webhook execution for ${foundWebhook.provider} webhook (${reason})`
359+
`[${requestId}] Queued direct webhook execution for ${foundWebhook.provider} webhook (Trigger.dev disabled)`
365360
)
366361
}
367362

0 commit comments

Comments
 (0)