Skip to content

[Bug]: Type error with newest node version 19.6.1 due to update of undici to version 5.19.1  #10118

@lukas-warrify

Description

@lukas-warrify

What version of React Router are you using?

6.8.1

Steps to Reproduce

In all our components, which are using react-router, if we run tests using the latest node version 19.6.1, we get a type error. This is most likely due to an update of the undici dependency to version >=5.19.0 (see nodejs/undici@7615308 for further information).

E.g. we have a simple component which just has a button redirecting to a sign up page:

  const handleProceedSignUp = React.useCallback(() => {
    navigate(
      {
        pathname: "/sign-up",
        search: location.search,
      },
      { state: location.state }
    );
  }, [navigate, location]);

Expected Behavior

No type errors are raised.

Actual Behavior

Upon running tests with components that use navigate, I get the following error:

TypeError: The "emitter" argument must be an instance of EventEmitter or EventTarget. Received an instance of AbortSignal
❯ new NodeError node:internal/errors:399:5
❯ getEventListeners node:events:913:9
❯ new Request node:internal/deps/undici/undici:7132:17
❯ createClientSideRequest ../node_modules/@remix-run/router/router.ts:3214:10
❯ startNavigation ../node_modules/@remix-run/router/router.ts:1144:19
❯ Object.navigate ../node_modules/@remix-run/router/router.ts:1039:18
❯ push ../node_modules/react-router/lib/components.tsx:75:16
❯ navigate ../node_modules/react-router/lib/hooks.tsx:212:7

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions