File tree Expand file tree Collapse file tree 1 file changed +2
-14
lines changed
apps/sim/app/api/webhooks/test Expand file tree Collapse file tree 1 file changed +2
-14
lines changed Original file line number Diff line number Diff line change 11import { eq } from 'drizzle-orm'
22import { type NextRequest , NextResponse } from 'next/server'
3- import { env } from '@/lib/env'
43import { createLogger } from '@/lib/logs/console-logger'
54import { db } from '@/db'
65import { webhook } from '@/db/schema'
@@ -37,19 +36,8 @@ export async function GET(request: NextRequest) {
3736 const providerConfig = ( foundWebhook . providerConfig as Record < string , any > ) || { }
3837
3938 // Construct the webhook URL
40- const requestOrigin = new URL ( request . url ) . origin
41- // Ensure origin does not point to localhost for external API calls
42- const effectiveOrigin = requestOrigin . includes ( 'localhost' )
43- ? env . NEXT_PUBLIC_APP_URL || requestOrigin // Use env var if available, fallback to original
44- : requestOrigin
45-
46- const webhookUrl = `${ effectiveOrigin } /api/webhooks/trigger/${ foundWebhook . path } `
47-
48- if ( effectiveOrigin !== requestOrigin ) {
49- logger . debug (
50- `[${ requestId } ] Remapped localhost origin to ${ effectiveOrigin } for webhook testing`
51- )
52- }
39+ const baseUrl = new URL ( request . url ) . origin
40+ const webhookUrl = `${ baseUrl } /api/webhooks/trigger/${ foundWebhook . path } `
5341
5442 logger . info ( `[${ requestId } ] Testing webhook for provider: ${ provider } ` , {
5543 webhookId,
You can’t perform that action at this time.
0 commit comments