Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save NullVoxPopuli/65d8fad8c736e66f58cdd4c5baedb0cb to your computer and use it in GitHub Desktop.
Save NullVoxPopuli/65d8fad8c736e66f58cdd4c5baedb0cb to your computer and use it in GitHub Desktop.
Problems with vite and http/2 in large apps

Much of the benefit of vite + http/2 is the ability to rely on cached requests of http/2 -- as in, turning off "disable cache" in the network tools.

However, when an app has to perform 10k network requests on boot, chrome and firefox error with:

I believe this is potentially related to limitations in maybe both the browser and the server

  • https://issues.chromium.org/issues/355006326 - the main issue report to Chromium about this use case (large ES module graph)
    • Errors we can receive
      • net::ERR_FAILED
      • net::ERR_HTTP2_PROTOCOL_ERROR
    • Hope
      • https://issues.chromium.org/issues/355006326#comment27

        Modifying nginx server config to use keepalive_requests 10000; and it solved the problem. Vite issue thread that is still open and related to this vitejs/vite#17499

        However, it's unclear whether we can do anything with Vite or Chrome to fix this -- as we are using dev mode, and nginx isn't relevant

  • I can avoid errors entirely if I throttle the network to "Fast 4G" (this is, however, very slow)
    • after this completely, I can un-throttle the network, and all requests succeed
  • I can avoid errors by checking "Disable cache" -- this, however, defeats the point of http/2 and vite

Related information:


Things to keep an eye on

Repros

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment