@@ -824,14 +824,27 @@ describe.skipIf(process.env.NETLIFY_TEST_DISABLE_LIVE === 'true').concurrent('co
824824 true ,
825825 ) ) as unknown as Deploy
826826
827+ // Add retry logic for fetching deployed functions
828+ const fetchWithRetry = async ( url : string , maxRetries = 5 ) => {
829+ for ( let i = 0 ; i < maxRetries ; i ++ ) {
830+ try {
831+ return await fetch ( url )
832+ } catch ( error ) {
833+ if ( i === maxRetries - 1 ) throw error
834+ await pause ( 2000 * ( i + 1 ) ) // Exponential backoff: 2s, 4s, 6s, 8s
835+ }
836+ }
837+ throw new Error ( `Failed to fetch ${ url } after ${ maxRetries } retries` )
838+ }
839+
827840 const [ response1 , response2 , response3 , response4 , response5 , response6 , response7 ] = await Promise . all ( [
828- fetch ( `${ deployUrl } /.netlify/functions/func-1` ) . then ( ( res ) => res . text ( ) ) ,
829- fetch ( `${ deployUrl } /.netlify/functions/func-2` ) . then ( ( res ) => res . text ( ) ) ,
830- fetch ( `${ deployUrl } /.netlify/functions/func-3` ) . then ( ( res ) => res . text ( ) ) ,
831- fetch ( `${ deployUrl } /.netlify/functions/func-4` ) ,
832- fetch ( `${ deployUrl } /internal-v2-func` ) . then ( ( res ) => res . text ( ) ) ,
833- fetch ( `${ deployUrl } /framework-function-1` ) . then ( ( res ) => res . text ( ) ) ,
834- fetch ( `${ deployUrl } /framework-edge-function-1` ) . then ( ( res ) => res . text ( ) ) ,
841+ fetchWithRetry ( `${ deployUrl } /.netlify/functions/func-1` ) . then ( ( res ) => res . text ( ) ) ,
842+ fetchWithRetry ( `${ deployUrl } /.netlify/functions/func-2` ) . then ( ( res ) => res . text ( ) ) ,
843+ fetchWithRetry ( `${ deployUrl } /.netlify/functions/func-3` ) . then ( ( res ) => res . text ( ) ) ,
844+ fetchWithRetry ( `${ deployUrl } /.netlify/functions/func-4` ) ,
845+ fetchWithRetry ( `${ deployUrl } /internal-v2-func` ) . then ( ( res ) => res . text ( ) ) ,
846+ fetchWithRetry ( `${ deployUrl } /framework-function-1` ) . then ( ( res ) => res . text ( ) ) ,
847+ fetchWithRetry ( `${ deployUrl } /framework-edge-function-1` ) . then ( ( res ) => res . text ( ) ) ,
835848 ] )
836849
837850 t . expect ( response1 ) . toEqual ( 'User 1' )
0 commit comments