web icon indicating copy to clipboard operation
web copied to clipboard

Server failing when loading video and using the koa-range middleware

Open bengfarrell opened this issue 3 years ago • 1 comments

I'm coming back to a project after a while where I used koa-range to be able to scrub video when using web dev server.

Using the middleware worked great a while back. However, now when updated to the latest ("@web/dev-server": "^0.1.31"), when first loading my dev server, things seem fine, but on page refresh, I get an http2 protocol error along with a not very helpful JS warning:

Screen Shot 2022-05-26 at 6 48 47 PM

This doesn't happen when I don't load video but leave the middleware in my config. It also doesn't happen when I load video but don't use the middleware.

bengfarrell avatar May 27 '22 01:05 bengfarrell

I was just playing around, and when I turned the HTTP2 option off in my web dev server config, all seems well now. I don't recall why I had it on in the first place. I'll leave the bug open, since it still feels like there's an issue, even if it doesn't block me now. Here's my full config if it helps:

const range = require('koa-range');
const fromRollup = require('@web/dev-server-rollup').fromRollup;
const Alias = require('@rollup/plugin-alias');
const pluginAlias = fromRollup(Alias);

const projectRootDir = process.cwd();

module.exports = {
    port: 8080,
    watch: true,
    nodeResolve: true,
    // http2: true,
    preserveSymlinks: true,
    middlewares: [ range ],
    plugins: [
        pluginAlias({
            entries: [
                {
                    find: '@mediapipe/pose',
                    replacement: `${projectRootDir}/libs/mediapipepose-bundle.js`,
                },
            ],
        }),
    ],
};

bengfarrell avatar May 27 '22 03:05 bengfarrell