@@ -129,6 +129,7 @@ const withTailscalePairing = <A, E, R>(
129129 readonly handlers : Record < string , { readonly Proxy : string } > ;
130130 readonly funnel ?: boolean ;
131131 readonly devUrl ?: string ;
132+ readonly tailscaleProbeError ?: Error ;
132133 } ,
133134 run : ( baseDir : string , commands : Array < ReadonlyArray < string > > ) => Effect . Effect < A , E , R > ,
134135) =>
@@ -191,6 +192,12 @@ const withTailscalePairing = <A, E, R>(
191192 "http://127.0.0.1:3773/.well-known/t3/environment" ,
192193 "https://desktop.tail.ts.net/.well-known/t3/environment" ,
193194 ] ) . toContain ( String ( url ) ) ;
195+ if (
196+ String ( url ) === "https://desktop.tail.ts.net/.well-known/t3/environment" &&
197+ input . tailscaleProbeError !== undefined
198+ ) {
199+ return Promise . reject ( input . tailscaleProbeError ) ;
200+ }
194201 return Promise . resolve (
195202 new Response ( JSON . stringify ( testDescriptor ) , {
196203 headers : { "content-type" : "application/json" } ,
@@ -225,6 +232,32 @@ const withDescriptorServer = <A, E, R>(run: (origin: string) => Effect.Effect<A,
225232 ) ;
226233
227234describe ( "t3 pair" , ( ) => {
235+ it . effect ( "preserves a foreign handler when the tailnet probe fails DNS resolution" , ( ) =>
236+ provideCliTestLayers (
237+ withTailscalePairing (
238+ {
239+ handlers : { "/" : { Proxy : "http://127.0.0.1:9000" } } ,
240+ tailscaleProbeError : new TypeError ( "fetch failed" , {
241+ cause : Object . assign ( new Error ( "getaddrinfo ENOTFOUND desktop.tail.ts.net" ) , {
242+ code : "ENOTFOUND" ,
243+ } ) ,
244+ } ) ,
245+ } ,
246+ ( baseDir , commands ) =>
247+ Effect . gen ( function * ( ) {
248+ const error = yield * runCli ( [ "pair" , "--base-dir" , baseDir , "--tailscale" ] ) . pipe (
249+ Effect . flip ,
250+ ) ;
251+ expect ( error ) . toBeInstanceOf ( ServePortOccupiedError ) ;
252+ expect ( commands ) . toEqual ( [
253+ [ "status" , "--json" ] ,
254+ [ "serve" , "status" , "--json" ] ,
255+ ] ) ;
256+ } ) ,
257+ ) ,
258+ ) ,
259+ ) ;
260+
228261 it . effect . each ( [
229262 { name : "Funnel" , handlers : { "/" : { Proxy : "http://127.0.0.1:3773" } } , funnel : true } ,
230263 {
0 commit comments