vite: Cannot read properties of undefined (reading 'isSelfAccepting')
Describe the bug
Occasionally requests are failing with an error:
35a0d891 > TypeError: Cannot read properties of undefined (reading 'isSelfAccepting')
35a0d891 > at TransformContext.transform (file:///Users/gajus/Developer/contra/gaia/node_modules/.pnpm/vite@4.2.2_@types+node@18.16.0_sass@1.62.0/node_modules/vite/dist/node/chunks/dep-d305c21f.js:41735:43)
35a0d891 > at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
35a0d891 > at async Object.transform (file:///Users/gajus/Developer/contra/gaia/node_modules/.pnpm/vite@4.2.2_@types+node@18.16.0_sass@1.62.0/node_modules/vite/dist/node/chunks/dep-d305c21f.js:43464:30)
Reproduction
N/A
Steps to reproduce
No response
System Info
System:
OS: macOS 13.2.1
CPU: (10) arm64 Apple M1 Max
Memory: 520.14 MB / 64.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 19.8.1 - ~/.nvm/versions/node/v19.8.1/bin/node
npm: 9.5.1 - ~/.nvm/versions/node/v19.8.1/bin/npm
Watchman: 2023.03.13.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 112.0.5615.137
Safari: 16.3
npmPackages:
@vitejs/plugin-react: ^3.1.0 => 3.1.0
vite: ^4.2.2 => 4.2.2
### Used Package Manager
pnpm
### Logs
_No response_
### Validations
- [X] Follow our [Code of Conduct](https://github.com/vitejs/vite/blob/main/CODE_OF_CONDUCT.md)
- [X] Read the [Contributing Guidelines](https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md).
- [X] Read the [docs](https://vitejs.dev/guide).
- [X] Check that there isn't [already an issue](https://github.com/vitejs/vite/issues) that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to [vuejs/core](https://github.com/vuejs/core) instead.
- [X] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/vitejs/vite/discussions) or join our [Discord Chat Server](https://chat.vitejs.dev/).
- [X] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 8
- Comments: 27 (17 by maintainers)
This issue should be fixed by https://github.com/vitejs/vite/pull/13231, please report back, and let’s reopen it if you still hit this bug after the next patch.
@patak-dev there seems to be a similar issue popping up while using Storybook with Vite. I’ve linked the issue above. Like the other commenters above, I’m also not able to consistently get this error to appear - but for me it results in not being able to run Storybook 90% of the time, until it randomly works. I’ve posted the output in the Storybook issue linked above, hopefully that might help getting to the bottom of this.
Hi @patak-dev, I’ve given a #13085 a try and it didn’t seem to remove the issue. Let me know if I can help with any further logs or reproduction steps.
Given that some other users mentioned this was happening specifically within Playwright tests, here are some of my findings and how it was being produced:
Context:
Reproduction steps:
Cannot read properties of undefined (reading 'isSelfAccepting')error occurs.I was able to avoid this by:
Hope this helps in some way!
cc @gajus
@patak-dev I am in the same team with @JasonObeid 😃
Same. It happens when running Playwright tests
It is happening in Vite 4.2 and Vite 4.3.
In my case, it is easy to replicate this by running Playwright Tests in parallel against Vite instance, i.e. multiple instances of browser talking with the same Vite HMR instance at once.
So it is not something that can be replicated in isolation (as far as I can think), but rather how the client interacts with it.
@brillout - On my end, it unfortunately doesn’t happen reliably, and I’m not even sure how to replicate it.
While debugging, I tried removing; then adding back in the same change that caused it, and it worked fine the second time.
When it does happen, I typically have to restart vite, and it works again for a while, but eventually out of the blue it will come back again. Maybe some type of memory leak? Hard to say, but hopefully that’s helpful.
Happy to provide more information, if there’s something else needed?
Thanks