File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
packages/core/functions-js/test/relay Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -116,8 +116,18 @@ export async function runRelay(
116116 await new Promise ( ( resolve ) => setTimeout ( resolve , 1000 ) )
117117 return new Relay ( startedRelay , id , execCache , execRun )
118118 }
119- } catch {
120- /* we actually don't care about errors here */
119+ } catch ( error ) {
120+ // Native fetch throws an error when it encounters HTTP 101 (WebSocket upgrade)
121+ // If we get a network error that indicates the server responded (even with 101),
122+ // we consider the function ready to serve
123+ if ( error instanceof TypeError && error . message . includes ( 'fetch' ) ) {
124+ // This likely means we got a 101 response that native fetch couldn't handle
125+ // The server is responding, so consider it ready
126+ log ( `function started to serve (detected via 101 error): ${ slug + '-' + id } ` )
127+ await new Promise ( ( resolve ) => setTimeout ( resolve , 1000 ) )
128+ return new Relay ( startedRelay , id , execCache , execRun )
129+ }
130+ // For other errors (connection refused, etc.), continue retrying
121131 }
122132 await new Promise ( ( resolve ) => setTimeout ( resolve , 500 ) )
123133 }
You can’t perform that action at this time.
0 commit comments