Repository navigation
Closed
Labels
Description
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.
Reacted by Lance Tipton, Shravya Bollam, daniel, Abdallatif Sulaiman, Jared Brown, Max Payson, Jason Obeid and Aria Kassaei
Activity
gajus commentedon Apr 27, 2023
Just realized that we are not on the latest version of Vite.
Attempting to replicate this with Vite v4.3.3.
gajus commentedon Apr 27, 2023
Confirmed that the same error is present on v4.3.3
gajus commentedon Apr 27, 2023
This appears to be some sort of a race condition. It does not happen if I access the web app in a single browser instance. It starts breaking when I try to run Playwright tests against the Vite instance using 5 parallel instances.
fc commentedon Apr 27, 2023
We've also run into this issue. Does it seem to be related to vite cache for you at all? Have you tried deleting all cache files before running tests to workaround it?
rm -rf ./node_modules/.vite*gajus commentedon Apr 28, 2023
I don't think so. I can pretty consistently replicate this when requesting the web app using several parallel processes. It appears to be some sort of a race condition.
justb3a commentedon Apr 28, 2023
+1, also getting
rm -rf ./node_modules/.vite*did not change anything.I use vite (@latest) with ladle and npm. Next line in log is
Plugin: vite:import-analysis, don't know if this might be related.I found the following (already merged) old PR #7993 also having issues with
isSelfAcceptingandvite:import-analysis.lancetipton commentedon Apr 28, 2023
+1, for me as well.
Came to github to report the issue and found this issue already opened. Figured I'd add to it instead of creating a new one.
It seems to happen on random files and is not consistent. See image below.
brillout commentedon Apr 28, 2023
Can someone reproduce this reliably?
lancetipton commentedon Apr 28, 2023
@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
justb3a commentedon Apr 28, 2023
@brillout on my end it fails quite reliable. 10% on start, 80% on first code change save, 10% on second code change save.
…but if I only serve the styleguide using ladle and vite (the one which fails), then it seems to work like a charm!
I use
run-pto start several scripts in parallel, maybe something is going on here.npm run dev-> ladle is failingnpm run dev:ladle-> ladle seems to workedit: Removing
remix watchsolves the issue. All other scripts work perfectly next to each other usingrun-p. 🧐MrFlashAccount commentedon Apr 28, 2023
@justb3a Maybe the reason might be because 2
viteprocesses running simultaneously.patak-cat commentedon Apr 28, 2023
Please try to create a minimal reproduction using vite.new or a github repo to share here. Also, is this something that started happening in Vite 4.3? It looks from @gajus' original issue that 4.2 was also affected.
gajus commentedon Apr 28, 2023
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.
justb3a commentedon May 2, 2023
It used to work without issues for a long time.
jonavila commentedon May 3, 2023
Same. It happens when running Playwright tests
patak-cat commentedon May 3, 2023
Would you try if this PR fixes your issue? #13085
justb3a commentedon May 4, 2023
Assuming I built everything correctly, it still throws
[vite] Internal server error: Cannot set properties of undefined (setting 'isSelfAccepting') Plugin: vite:import-analysis.I used StackBlitz Codeflow to build the bundle and types. Somehow, building the types does not work.
Thanks for taking care of the issue 🙏
JasonObeid commentedon May 10, 2023
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-cat commentedon May 10, 2023
Thanks for the detailed comment @JasonObeid! @gajus, I wonder if something similar is happening in your case. Vite should still be able to cope with this scenario though (although the bug showed in this case that Jason's setup could be improved).
gajus commentedon May 10, 2023
@patak-dev I am in the same team with @JasonObeid :-)
mauricekleine commentedon May 15, 2023
@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.
Artur- commentedon May 17, 2023
We see this in every CI build of a given project starting from an update (not Vite update) yesterday. The output seems similar to what is described above
The changed files are imported in
vite.config.tsSometimes instead of "internal server error", the error is only
Artur- commentedon May 17, 2023
With the PR version (#13085) I still see
sometimes the error is also combined with
Artur- commentedon May 17, 2023
When using the PR, the
isSelfAcceptingissue comes fromvite/packages/vite/src/node/plugins/importAnalysis.ts
Line 266 in d09bbd0
importeris/home/circleci/pre-lit/frontend/themes/pre-lit/styles.css?inlineArtur- commentedon May 17, 2023
Cannot read properties of undefined (reading 'url')is reported for the sameimporterbefore theisSelfAcceptingerror, atvite/packages/vite/src/node/plugins/importAnalysis.ts
Line 730 in d09bbd0
Artur- commentedon May 17, 2023
Seems this is caused (or triggered) by #12599. The commit before that, 276725f works.
patak-cat commentedon May 17, 2023
This issue should be fixed by #13231, please report back, and let's reopen it if you still hit this bug after the next patch.