@@ -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