@@ -400,16 +400,15 @@ export class FunctionsEmulator implements EmulatorInstance {
400400 async sendRequest ( trigger : EmulatedTriggerDefinition , body ?: any ) {
401401 const record = this . getTriggerRecordByKey ( this . getTriggerKey ( trigger ) ) ;
402402 const pool = this . workerPools [ record . backend . codebase ] ;
403- const runtime = record . backend . runtime ;
404- if ( ! pool . readyForWork ( trigger . id , runtime ) ) {
403+ if ( ! pool . readyForWork ( trigger . id , record . backend . runtime ) ) {
405404 try {
406405 await this . startRuntime ( record . backend , trigger ) ;
407406 } catch ( e : any ) {
408407 this . logger . logLabeled ( "ERROR" , `Failed to start runtime for ${ trigger . id } : ${ e } ` ) ;
409408 return ;
410409 }
411410 }
412- const worker = pool . getIdleWorker ( trigger . id , runtime ) ! ;
411+ const worker = pool . getIdleWorker ( trigger . id , record . backend . runtime ) ! ;
413412 if ( this . debugMode ) {
414413 await worker . sendDebugMsg ( {
415414 functionTarget : trigger . entryPoint ,
@@ -424,7 +423,7 @@ export class FunctionsEmulator implements EmulatorInstance {
424423
425424 // For Dart, include the function name in the path so the server can route
426425 // For other runtimes, use / as they use FUNCTION_TARGET env var
427- const isDart = isLanguageRuntime ( runtime , "dart" ) ;
426+ const isDart = isLanguageRuntime ( record . backend . runtime , "dart" ) ;
428427 const path = isDart ? `/${ trigger . name } ` : `/` ;
429428
430429 return new Promise ( ( resolve , reject ) => {
@@ -1887,8 +1886,7 @@ export class FunctionsEmulator implements EmulatorInstance {
18871886 this . logger . log ( "DEBUG" , `[functions] Got req.url=${ req . url } , mapping to path=${ path } ` ) ;
18881887
18891888 const pool = this . workerPools [ record . backend . codebase ] ;
1890- const runtime = record . backend . runtime ;
1891- if ( ! pool . readyForWork ( trigger . id , runtime ) ) {
1889+ if ( ! pool . readyForWork ( trigger . id , record . backend . runtime ) ) {
18921890 try {
18931891 await this . startRuntime ( record . backend , trigger ) ;
18941892 } catch ( e : any ) {
@@ -1917,7 +1915,7 @@ export class FunctionsEmulator implements EmulatorInstance {
19171915 res as http . ServerResponse ,
19181916 reqBody ,
19191917 debugBundle ,
1920- runtime ,
1918+ record . backend . runtime ,
19211919 ) ;
19221920 }
19231921}
0 commit comments