mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-09 15:07:55 -05:00
fix test webhook url (#1594)
This commit is contained in:
committed by
waleed
parent
833e700b58
commit
97a8778449
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user