-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Content length mismatch for modules when accessing dev server through android emulator #19800
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
Comments
I've checked if I can reproduce it but it worked fine on my machine. I guess you have to debug the reason on your own. |
@sapphi-red What setup did you use? It's been successfully repro'd on a few machines so it's odd that it didn't on yours |
I used Android emulator 35.4.9-13025442 + Pixel 9 API 35 on Windows 11. |
It looks like you are accessing the Vite dev server via 10.0.0.0/n. Maybe there's a proxy or something similar modifying your content? |
Could I trouble you to also test on a lower version of the android API? specifically 31 There isn't any proxy setup, it's how the emulator is able to get to localhost when it runs on the same machine |
I've tested with Pixel 5 + API 31 now, but it doesn't reproduce. |
Drats, thank you for testing again for me. Hopefully someone else will be able to repro it with more knowledge about the bundling and serving side of the vite dev server |
did you make any progress? i encountered same error with nuxt 3 developtment server. it's not happens with vue 3 somehow. |
Describe the bug
As part of upgrading one of our sites to use Vite, we have ran into an issue when accessing the dev server on various android emulators.
The issue seems to maybe stem from the web sockets / hot module reload, but unsure as each "fix" we have attempted hasn't proven fruitful and the access via the emulator remains flaky. When it fails the tab remains a white screen.
Below is the screenshot of the exact error when accessing the chrome inspector for emulators via

chrome://inspect/#devices
(to see the network tab)The content that is required to be transferred appears to be larger than the expected content-length from the vite dev server.
Removing the sass aspect of the App.scss did not resolve the issue, only moved it to another module (e.g., MUI).
I have attached a repo with a minimal reproduction and response content. The only other issue that seems related is this closed issue.
Reproduction
https://github.com/ajscott-hcs/vite-dev-android
Steps to reproduce
Steps are wtihin the top level readme of the repro repo, but will add here for brevity.
Ensure you also have an android emulator running, this currently has been tested against the following emulators:
System Info
Used Package Manager
npm
Logs
Reponse content
"response": {
"status": 200,
"statusText": "OK",
"httpVersion": "HTTP/1.1",
"headers": [],
"cookies": [],
"content": {
"size": 3774708,
"mimeType": "text/css",
"compression": 10815
},
"redirectURL": "",
"headersSize": 237,
"bodySize": 3763893,
"_transferSize": 3764130,
"_error": "net::ERR_CONTENT_LENGTH_MISMATCH"
},
Validations
The text was updated successfully, but these errors were encountered: