Error with `dispatcher.close` in Effect Typescript library using Undici HttpClient

I'm trying to run this code, but running into the error:
TypeError: dispatcher.close is not a function. (In 'dispatcher.close()', 'dispatcher.close' is undefined)

export class MyService extends Effect.Service<MyService>()("package/MyService", {
  effect: Effect.gen(function* () {
    const httpClient = yield* HttpClient.HttpClient.pipe(Effect.map(HttpClient.filterStatusOk));
    const path = yield* Path.Path;
    const fs = yield* FileSystem.FileSystem;

    const downloadImage = (url: string) =>
      Effect.gen(function* () {
        const response = yield* httpClient.get(url, {});
        const arrayBuffer = yield* response.arrayBuffer;
        const buffer = new Uint8Array(arrayBuffer);
        const fileName = path.basename(new URL(url).pathname);
        const filePath = path.join("./downloads", fileName);
        yield* fs.writeFile(filePath, buffer);
      });
    return { downloadImage } as const;
  }),
  dependencies: [NodeHttpClient.layerUndici, NodeContext.layer],
}) {}

is there anything I need to do? I can't find any examples in the documentation and when I search on here there is only 1 result that didn't get an answer
Was this page helpful?