chrome throw ERR_HTTP2_PROTOCOL_ERROR
See original GitHub issueDescribe the bug
When I run vite devServer, Chrome occasionally fails to load some js files. The error message is net::ERR_HTTP2_PROTOCOL_ERROR. Then I re-run vite devServer and reload it, and it runs fine. But when I copied the url and opened it in a new tab, it broke again. This error only occurs in Chrome, FireFox is working fine.
I find some net log in chrome://net-internals/#events:
This is the gist of the error: HTTP2_STREAM_ERROR –> description = “Server reset stream.” –> net_error = “ERR_HTTP2_PROTOCOL_ERROR” –> stream_id = 13571
Reproduction
export const getViteConfig = (): InlineConfig => {
const packages = [];
return {
configFile: false,
mode: 'development',
publicDir: path.resolve(process.cwd(), '.temp/vite-static'),
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true,
},
},
},
define: {
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
__BUILDING_TOOL__: JSON.stringify('vite'),
__DEV__: true,
__DEBUG_INFO__: JSON.stringify(process.env.DEBUG_INFO || ''),
__PRIVATE__: JSON.stringify(process.env.PRIVATE),
__PRIVATE_VERSION__: JSON.stringify(process.env.PRIVATE_VERSION || ''),
},
resolve: {
alias: packages.reduce(
(prev, curr) => ({
...prev,
[curr.packageJson?.name]: path.resolve(rootPath, curr.rootPath, 'src'),
}),
{
'~antd/dist/antd.less': path.resolve(rootPath, 'node_modules/antd/dist/antd.less'),
'~antd/lib/message/style/index.css': path.resolve(rootPath, 'node_modules/antd/lib/message/style/index.css'),
},
),
mainFields: ['main', 'module', 'jsnext:main', 'jsnext'],
extensions: ['.mjs', '.js', '.ts', '.jsx', '.tsx', '.json'],
},
server: {
https: true,
port: 5001,
hmr: {
host: '127.0.0.1',
},
},
};
};
// ...
const server = await createServer(getViteConfig());
await server.listen();
System Info
System:
OS: macOS 10.15.6
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 21.06 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 14.17.1 - ~/.nvm/versions/node/v14.17.1/bin/node
Yarn: 1.22.10 - ~/.nvm/versions/node/v14.17.1/bin/yarn
npm: 7.19.1 - ~/.nvm/versions/node/v14.17.1/bin/npm
Browsers:
Chrome: 92.0.4515.107
Firefox: 90.0.2
Safari: 13.1.2
npmPackages:
vite: ^2.4.3 => 2.4.3
Used Package Manager
yarn
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- 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 https://github.com/vuejs/vue-next instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:14
- Comments:9 (4 by maintainers)
Top Results From Across the Web
What's the net::ERR_HTTP2_PROTOCOL_ERROR about?
The issue is that when there's no disk space left on the disk, some webservers (nginx definitely but maybe apache as well) are...
Read more >What is ERR_HTTP2_PROTOCOL_ERROR? How to Fix it?
HTTP2 protocol error might occur on a client device mainly due to browser issues or interference from the network.
Read more >How to Fix ERR_HTTP2_PROTOCOL_ERROR in Chrome
1. Open Google Chrome. Click the ellipsis at the top-right corner, select More tools and click Extensions. ... 2. Toggle the slider to...
Read more >Err_http2_protocol_error? Please help, all browsers including ...
I've tried to research and find fixes such as command prompt actions and redownloading Internet drivers but nothing has worked. Other people in ......
Read more >How to Fix ERR_SSL_PROTOCOL_ERROR on Google Chrome
QUIC (Quick UDP Internet Connections) provides a TLS/SSL equivalent connection to Google's servers. By default, the QUIC protocol is enabled in Chrome. To ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I resolved this by disabling http/2 in the dev server. https://vitejs.dev/config/#server-https
In
vite.config.js
:There may be an error between how chrome handles http/2 and how node.js has http/2 implemented. https://bugs.chromium.org/p/chromium/issues/detail?id=1045328#c68
We were able to resolve this following https://github.com/vitejs/vite/pull/3895 and adding
maxSessionMemory: 100
to server.https in the vite config