-
-
Notifications
You must be signed in to change notification settings - Fork 503
-
-
Notifications
You must be signed in to change notification settings - Fork 503
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
TypeError: 'set' on proxy: trap returned falsish for property 'timeout' (Axios, XHR, Happy DOM) #1816
Comments
Hi, @Fallsleep. Thanks for reporting this. So, a bit of context.
Then, I gave the error message itself a quick search and it seems to be way too low-level for web to know much about it (it surfaces as random errors of different libraries, nothing to do with From what I understand, JavaScript has trouble assigning (setting) the |
Hi, @Fallsleep. I've added a test to reproduce this but could not: Could you please take a look and see if something's different from what you have? Dependencies used in the test:
The request using the |
A minor thing I noticed in your test: you are calling |
@kettanaito I am able to reproduce this error in my project, even when adding the mswjs/interceptors like in your comment. The setupservers in my case is in beforeAll of the executed test. I use an old axios version, but I tried with the latest as well, same issue. If I change the adapter to http, II get the following: and also: TypeError: body.getReader is not a function Running via vitest with vue. If I update axiios to latest along with mswjs/interceptors, no difference. |
What is the Node.js version you are using? The |
Dependencies:
in my own project, I do use |
I found the different of dependencies, my project and reproduction both use When I change the environment to According axios/axios#5917 (comment), maybe there's something wrong in |
Thanks for that clarification, @Fallsleep! It's extremely important. I will look into what Happy DOM does with the |
I can confirm that switching the test to Happy DOM produces the error: FAIL modules/XMLHttpRequest/regressions/xhr-axios-xhr-adapter.test.ts > performs a request with the "xhr" axios adapter
TypeError: 'set' on proxy: trap returned falsish for property 'timeout'
❯ dispatchXhrRequest ../node_modules/.pnpm/axios@1.6.0/node_modules/axios/lib/adapters/xhr.js:91:21
❯ xhr ../node_modules/.pnpm/axios@1.6.0/node_modules/axios/lib/adapters/xhr.js:49:10
❯ Axios.dispatchRequest ../node_modules/.pnpm/axios@1.6.0/node_modules/axios/lib/core/dispatchRequest.js:51:10
❯ Axios.request ../node_modules/.pnpm/axios@1.6.0/node_modules/axios/lib/core/Axios.js:146:33
❯ wrap ../node_modules/.pnpm/axios@1.6.0/node_modules/axios/lib/helpers/bind.js:5:15
❯ modules/XMLHttpRequest/regressions/xhr-axios-xhr-adapter.test.ts:29:21 |
I found the root cause and pushed the fix in mswjs/interceptors#477. The test is passing locally using Axios, XHR adapter, and Happy DOM. |
Released: v2.0.4 🎉This has been released in v2.0.4! Make sure to always update to the latest version ( Predictable release automation by @ossjs/release. |
Prerequisites
Environment check
msw
versionNode.js version
v18.17.1/v18.18.0
Reproduction repository
https://stackblitz.com/edit/github-6z7ngr-yehgpa?file=tests%2Fhappy-dom.test.ts,tests%2Fjsdom.test.ts,tests%2Fnode.test.ts
Reproduction steps
open stackblitz, it already set run vitest, or run
yarn test
Current behavior
it seems proxy
XMLHttpRequest
class,axios
set request property failed.call stack trace:
Expected behavior
axios
can request well invitest
.maybe it's
axios
bug, I also opened an issue there: axios/axios#6050add config in
axios.create
:or set it in
beforeAll
can both make the reproduction test passed.
But in my project, the test passed, but Vitest still catch the error, util I set default config before
axios.create
The text was updated successfully, but these errors were encountered: