File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,11 +71,14 @@ export async function createTeamsSubscription(
7171 }
7272
7373 // Build notification URL
74- const requestOrigin = new URL ( request . url ) . origin
75- const effectiveOrigin = requestOrigin . includes ( 'localhost' )
76- ? env . NEXT_PUBLIC_APP_URL || requestOrigin
77- : requestOrigin
78- const notificationUrl = `${ effectiveOrigin } /api/webhooks/trigger/${ webhook . path } `
74+ // Always use NEXT_PUBLIC_APP_URL to ensure Microsoft Graph can reach the public endpoint
75+ if ( ! env . NEXT_PUBLIC_APP_URL ) {
76+ teamsLogger . error (
77+ `[${ requestId } ] NEXT_PUBLIC_APP_URL not configured, cannot create Teams subscription`
78+ )
79+ return false
80+ }
81+ const notificationUrl = `${ env . NEXT_PUBLIC_APP_URL } /api/webhooks/trigger/${ webhook . path } `
7982
8083 // Subscribe to the specified chat
8184 const resource = `/chats/${ chatId } /messages`
You can’t perform that action at this time.
0 commit comments