Hi, i am trying to setup a HttpClientService with a proxy. I currently have two different implementations and none seems to be working. I am working on Windows with Deno if that matters. Here's my first approach: ```ts import { HttpClientRequest } from "@effect/platform"; import { FetchHttpClient } from '@effect/platform'; import { CookieService } from './CookieService.ts'; import { Effect as E, Schema, RcRef, Redacted, Config, Option, Console, Layer, } from "effect"; import { FetchHttpClient, HttpClient, HttpClientRequest, HttpClientResponse, } from "@effect/platform"; import { CookieService } from "./CookieService.ts"; import { HttpsProxyAgent } from "https-proxy-agent"; export class HttpClientService extends E.Service()( "HttpClientService", { accessors: true, dependencies: [ FetchHttpClient.layer, CookieService.Default, ], scoped: E.gen(function* () { const proxyUrl = yield* Config.string("PROXY_STRING").pipe( Config.option ); const proxyClient = yield* HttpClient.HttpClient.pipe( E.provide( Layer.succeed(FetchHttpClient.RequestInit, { agent: new HttpsProxyAgent( proxyUrl.pipe(Option.getOrElse(() => "")) ), }) ), E.map(HttpClient.filterStatusOk) ); return { proxyClient }; }), } ) {} const program = E.gen(function* () { const proxyClient = yield* HttpClientService.proxyClient; const url = 'https://api.ipify.org?format=json'; const response = yield* HttpClientRequest.get(url).pipe( (request) => HttpClientService.withCookies(url, request), E.andThen((request) => proxyClient.execute(request)) ); const data = yield* response.json; yield* Console.log(data); }); const MainLayer = Layer.mergeAll( FetchHttpClient.layer, CookieService.Default, HttpClientService.Default ); const runnable = program.pipe( E.provide(MainLayer) ); E.runPromise(runnable) .then(() => console.log("Program finished")) .catch((error) => { console.error("Program failed:"); console.error(error); }); ``` It runs but it just doesn't use the proxy. No idea why. It's a http proxy in this format: username:password@hostname:port Second approach using NodeHttpClient: ```ts import { Console, Effect as E, Layer } from 'effect'; import { Config, RcRef, Redacted } from 'effect'; import { HttpClient, HttpClientRequest, } from '@effect/platform'; import { CookieService } from './CookieService.ts'; import { ProxyAgent } from 'npm:undici'; import { NodeHttpClient } from '@effect/platform-node'; export class HttpClientService extends E.Service()( 'HttpClientService', { accessors: true, dependencies: [ NodeHttpClient.layerUndici, CookieService.Default, ], scoped: E.gen(function* () { const proxyUrl = yield* Config.redacted('PROXY_STRING'); const proxyDispatcher = yield* E.acquireRelease( E.sync(() => new ProxyAgent({ uri: Redacted.value(proxyUrl), keepAliveTimeout: 60000 })), (dispatcher) => E.promise(() => dispatcher.destroy()), ); const proxyClient = NodeHttpClient.makeUndici(proxyDispatcher).pipe( HttpClient.filterStatusOk, ); return { proxyClient }; }), }, ) {} const program = E.gen(function* () { const proxyClient = yield* HttpClientService.proxyClient; const url = 'https://api.ipify.org/?format=json'; const t = yield* proxyClient.get(url).pipe( E.tap((r) => Console.log('Fetched recent market data', r.status)), ); Console.log('Response:', t.request); }); const MainLayer = Layer.mergeAll( HttpClientService.Default, ); const runnable = program.pipe( E.provide(MainLayer), ); E.runPromiseExit(runnable) .then(console.log) .catch((error) => { console.error('Program failed:'); console.error(error); }); ``` This uses the proxy but results in a RequestError: ```json { _id: "Exit", _tag: "Failure", cause: { _id: "Cause", _tag: "Fail", failure: { request: { _id: "@effect/platform/HttpClientRequest", method: "GET", url: "https://google.com", urlParams: [], hash: { _id: "Option", _tag: "None" }, headers: Object <[Object: null prototype]> { b3: "af0bac2701589fe711287c83a8cc000d-0b6f522add24293f-1", traceparent: "00-af0bac2701589fe711287c83a8cc000d-0b6f522add24293f-01", host: "google.com" }, body: { _id: "@effect/platform/HttpBody", _tag: "Empty" } }, reason: "Transport", headers: Object <[Object: null prototype]> { b3: "af0bac2701589fe711287c83a8cc000d-0b6f522add24293f-1", traceparent: "00-af0bac2701589fe711287c83a8cc000d-0b6f522add24293f-01", host: "google.com" }, body: { _id: "@effect/platform/HttpBody", _tag: "Empty" } }, reason: "Transport", traceparent: "00-af0bac2701589fe711287c83a8cc000d-0b6f522add24293f-01", host: "google.com" }, body: { _id: "@effect/platform/HttpBody", _tag: "Empty" } }, reason: "Transport", }, body: { _id: "@effect/platform/HttpBody", _tag: "Empty" } }, reason: "Transport", cause: BadResource: Bad resource ID body: { _id: "@effect/platform/HttpBody", _tag: "Empty" } }, reason: "Transport", cause: BadResource: Bad resource ID reason: "Transport", cause: BadResource: Bad resource ID cause: BadResource: Bad resource ID at TcpConn.setNoDelay (ext:deno_net/01_net.js:238:12) at TCP.setNoDelay (ext:deno_node/internal_binding/tcp_wrap.ts:238:30) at TLSSocket.Socket.setNoDelay (node:net:816:18) at TCP.setNoDelay (ext:deno_node/internal_binding/tcp_wrap.ts:238:30) at TLSSocket.Socket.setNoDelay (node:net:816:18) ``` It seems like this has something to do with how deno handels fetch but i'm not entirely sure about it. Here are the issues I found: https://github.com/denoland/deno/issues/27802, https://github.com/denoland/deno/issues/13617, https://github.com/denoland/deno/issues/19532 Any help appreciated