File tree Expand file tree Collapse file tree
apps/web/app/api/desktop/[...route] Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -610,22 +610,34 @@ app.post(
610610 ? `${ header . slice ( 0 , DISCORD_MESSAGE_MAX_LENGTH - 1 ) } …`
611611 : header ;
612612
613- const response = await fetch ( discordWebhookUrl , {
614- method : "POST" ,
615- headers : { "Content-Type" : "application/json" } ,
616- body : JSON . stringify ( {
617- content,
618- allowed_mentions : { parse : [ ] } ,
619- } ) ,
620- } ) ;
621-
622- if ( ! response . ok ) {
623- throw new Error (
624- `Failed to send session profile to Discord: ${ response . statusText } ` ,
613+ // Discord delivery is best-effort: the bundle is already in S3 and
614+ // the download URL is valid, so a webhook failure must not turn the
615+ // whole request into a 500 (which would make the client re-upload).
616+ try {
617+ const response = await fetch ( discordWebhookUrl , {
618+ method : "POST" ,
619+ headers : { "Content-Type" : "application/json" } ,
620+ body : JSON . stringify ( {
621+ content,
622+ allowed_mentions : { parse : [ ] } ,
623+ } ) ,
624+ } ) ;
625+
626+ if ( response . ok ) {
627+ discordDelivered = true ;
628+ } else {
629+ console . error (
630+ "Failed to send session profile to Discord:" ,
631+ response . status ,
632+ await response . text ( ) ,
633+ ) ;
634+ }
635+ } catch ( discordError ) {
636+ console . error (
637+ "Failed to send session profile to Discord:" ,
638+ discordError ,
625639 ) ;
626640 }
627-
628- discordDelivered = true ;
629641 }
630642
631643 return c . json ( { success : true , downloadUrl, discordDelivered } ) ;
You can’t perform that action at this time.
0 commit comments