Skip to content

TypeError: RequestInit: Expected signal ("AbortSignal {}") to be an instance of AbortSignal. #4966

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
MarcMcIntosh opened this issue May 6, 2025 · 5 comments

Comments

@MarcMcIntosh
Copy link

Happens when using node v24.0.0, with vitest, msw and jsdom.

Full error

An unhandled error occurred processing a request for the endpoint "ping".
In the case of an unhandled error, no tags will be "provided" or "invalidated". TypeError: RequestInit: Expected signal ("AbortSignal {}") to be an instance of AbortSignal.
    at Object.webidl.errors.exception (node:internal/deps/undici/undici:4096:14)
    at Object.AbortSignal (node:internal/deps/undici/undici:4338:31)
    at node:internal/deps/undici/undici:10747:41
    at node:internal/deps/undici/undici:4389:16
    at Object.RequestInit (node:internal/deps/undici/undici:4371:21)
    at new Request (node:internal/deps/undici/undici:10111:34)
    at Object.construct (file:///Users/marc/Projects/refact/refact-agent/gui/node_modules/@mswjs/interceptors/src/interceptors/ClientRequest/utils/recordRawHeaders.ts:185:33)
    at file:///Users/marc/Projects/refact/refact-agent/gui/node_modules/@reduxjs/toolkit/src/query/fetchBaseQuery.ts:236:21
    at Object.queryFn (/Users/marc/Projects/refact/refact-agent/gui/src/services/refact/ping.ts:15:26)
    at executeRequest (file:///Users/marc/Projects/refact/refact-agent/gui/node_modules/@reduxjs/toolkit/src/query/core/buildThunks.ts:308:20)

passes with node version 22

@markerikson
Copy link
Collaborator

Can you provide an actual repro? That doesn't give much to go on.

@phryneas
Copy link
Member

phryneas commented May 6, 2025

I would assume that you have some kind of AbortController polyfill in your application while undici requires you to use the node-native AbortController. Can you try to remove that polyfill?

@MarcMcIntosh
Copy link
Author

MarcMcIntosh commented May 6, 2025

@markerikson
sure it's in our CI https://github.com/smallcloudai/refact/actions/runs/14865630159/job/41742265895#step:5:2903
git clone cd /refact/refact-agent/gui && nvm use node && npm run test.

@phryneas I can try, I'll have to figure out where the polyfill is coming from 😅 (probably jsdom)

lukekarrys added a commit to vltpkg/vltpkg that referenced this issue May 7, 2025
GUI tests fail on Node 24. This is not an issue for the actual GUI
but with the tooling required to run the tests in Node (vitest, etc).
Found a similar report here: reduxjs/redux-toolkit#4966
For now just exclude it from the matrix always, we'll add it back later once
tooling catches up.
lukekarrys added a commit to vltpkg/vltpkg that referenced this issue May 7, 2025
GUI tests fail on Node 24. This is not an issue for the actual GUI
but with the tooling required to run the tests in Node (vitest, etc).
Found a similar report here:
reduxjs/redux-toolkit#4966
For now just exclude it from the matrix always, we'll add it back later
once tooling catches up.
@louh
Copy link

louh commented May 13, 2025

I'm seeing this same issue in my application, and we have a very similar setup with Vitest and MSW. Test log is here: https://github.com/streetmix/streetmix/actions/runs/14998382595/job/42138378871#step:8:1338

One thing we have in common is we are both using the builder.query() method in createApi's endpoints configuration. (see https://github.com/smallcloudai/refact/blob/cc30e2ef580786da140fe452c2a10174c35cb22c/refact-agent/gui/src/services/refact/ping.ts#L8-L9 and https://github.com/streetmix/streetmix/blob/f7f38c4628198ed21618cd585093e2d312ff35b6/client/src/store/services/api.ts#L19-L20)

I am not intentionally polyfilling fetch either.

@kavsingh
Copy link

kavsingh commented May 14, 2025

Ran into a similar issue with our application (closed source unfortunately so can't share a link, will try to get a repro up). We use toolkit and vitest, but not msw. Migrating our test env from jsdom to happy-dom resolved the issue - not an ideal solution but unblocked us from using node 24. These may be of interest: jsdom/jsdom#3682 (comment), jsdom/jsdom#3682 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants