File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -224,8 +224,18 @@ export class FunctionsRouter extends PromiseRouter {
224224 }
225225 } )
226226 . then ( result => {
227- // If result is returned and response hasn't already been sent via res.success/res.error
228- if ( result !== undefined && ! responseObject . _isResponseSent ( ) ) {
227+ // For Express-style functions, only send response if not already sent
228+ if ( theFunction . length >= 2 ) {
229+ if ( ! responseObject . _isResponseSent ( ) ) {
230+ // If Express-style function returns a value without calling res.success/error
231+ if ( result !== undefined ) {
232+ success ( result ) ;
233+ }
234+ // If no response sent and no value returned, this is an error in user code
235+ // but we don't handle it here to maintain backward compatibility
236+ }
237+ } else {
238+ // For traditional functions, always call success with the result (even if undefined)
229239 success ( result ) ;
230240 }
231241 } , error ) ;
You can’t perform that action at this time.
0 commit comments