Skip to content

Commit 97a8778

Browse files
icecrasher321waleed
authored andcommitted
fix test webhook url (#1594)
1 parent 833e700 commit 97a8778

File tree

1 file changed

+5
-5
lines changed
  • apps/sim/app/api/webhooks/[id]/test-url

1 file changed

+5
-5
lines changed

apps/sim/app/api/webhooks/[id]/test-url/route.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ export async function POST(request: NextRequest, { params }: { params: Promise<{
6464
return NextResponse.json({ error: 'Forbidden' }, { status: 403 })
6565
}
6666

67-
const origin = new URL(request.url).origin
68-
const effectiveOrigin = origin.includes('localhost')
69-
? env.NEXT_PUBLIC_APP_URL || origin
70-
: origin
67+
if (!env.NEXT_PUBLIC_APP_URL) {
68+
logger.error(`[${requestId}] NEXT_PUBLIC_APP_URL not configured`)
69+
return NextResponse.json({ error: 'Server configuration error' }, { status: 500 })
70+
}
7171

7272
const token = await signTestWebhookToken(id, ttlSeconds)
73-
const url = `${effectiveOrigin}/api/webhooks/test/${id}?token=${encodeURIComponent(token)}`
73+
const url = `${env.NEXT_PUBLIC_APP_URL}/api/webhooks/test/${id}?token=${encodeURIComponent(token)}`
7474

7575
logger.info(`[${requestId}] Minted test URL for webhook ${id}`)
7676
return NextResponse.json({

0 commit comments

Comments
 (0)