Skip to content

Commit b795536

Browse files
Adam GoughAdam Gough
authored andcommitted
fix: reverted route.ts file
1 parent a6fe706 commit b795536

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

apps/sim/app/api/webhooks/test/route.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { eq } from 'drizzle-orm'
22
import { type NextRequest, NextResponse } from 'next/server'
3-
import { env } from '@/lib/env'
43
import { createLogger } from '@/lib/logs/console-logger'
54
import { db } from '@/db'
65
import { 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,

0 commit comments

Comments
 (0)