Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions apps/sim/app/api/webhooks/[id]/test-url/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ export async function POST(request: NextRequest, { params }: { params: Promise<{
return NextResponse.json({ error: 'Forbidden' }, { status: 403 })
}

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

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

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