Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
fix: work around a Node v20 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmurdoch committed Jul 6, 2023
1 parent 5311c85 commit 2702f4f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/ethereum/ethereum/src/forking/handlers/http-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ import { BaseHandler } from "./base-handler";
import { Handler } from "../types";
import Deferred from "../deferred";

// Work around a node v20.0.0, v20.1.0, and v20.1.2 bug. The issue was fixed
// in v20.3.0.
// https://github.com/nodejs/node/issues/47822#issuecomment-1564708870
// Safe to remove once support for Node v20 is dropped.
if (
// webpack will replace process.env.IS_BROWSER with a boolean
!process.env.IS_BROWSER &&
process.versions &&
// check for `node` in case we want to use this in deno/bun/etc
process.versions.node &&
process.versions.node.match(/20\.[0-2]\.0/)
) {
require("net").setDefaultAutoSelectFamily(false);
}

const { JSONRPC_PREFIX } = BaseHandler;

export class HttpHandler extends BaseHandler implements Handler {
Expand Down

0 comments on commit 2702f4f

Please sign in to comment.