File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
apps/sim/app/api/webhooks/[id]/test-url Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff 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 ( {
You can’t perform that action at this time.
0 commit comments