question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Errors while and after using http2

See original GitHub issue

Describe the bug Enabling http2 in the wmr config causes an error and then prevents normal http to work afterwards.

To Reproduce

In an attempt to make the dev server using https (for which I couldn’t find any documentation) I experimented with the http2 setting (wmr.config.ts):

import { defineConfig } from 'wmr';

// Full list of options: https://wmr.dev/docs/configuration
export default defineConfig((options) => {
    return {
        alias: {
            react: 'preact/compat',
            'react-dom': 'preact/compat'
        },
        out: "build",
        host: "localhost",
        port: 3301,
        http2: true,
        sourcemap: true,
        debug: true,
    };
});

With that I ran my npm script dev:

"dev": "wmr start",

which asked me for a password (without explaining why’s that needed) and then failed:

Password:
Unable to create HTTP2 server, falling back to HTTP1:
Error: Command failed: openssl req -new -x509 -config /Users/mike/Downloads/Test/wmr/node_modules/openssl-configurations/certificate-authority-self-signing.conf -key /var/folders/03/gj5f1gl92w11zc3l2c526dnm0000gn/T/tmp-9362CpF75xdGDPVv.tmp -out /Users/mike/Library/Application Support/devcert/certificate-authority/certificate.cert -days 825
error on line -1 of /Users/mike/Downloads/Test/wmr/node_modules/openssl-configurations/certificate-authority-self-signing.conf
8137630976:error:02FFF002:system library:func(4095):No such file or directory:/AppleInternal/Library/BuildRoots/810eba08-405a-11ed-86e9-6af958a02716/Library/Caches/com.apple.xbs/Sources/libressl/libressl-3.3/crypto/bio/bss_file.c:122:fopen('/Users/mike/Downloads/Test/wmr/node_modules/openssl-configurations/certificate-authority-self-signing.conf', 'rb')
8137630976:error:20FFF080:BIO routines:CRYPTO_internal:no such file:/AppleInternal/Library/BuildRoots/810eba08-405a-11ed-86e9-6af958a02716/Library/Caches/com.apple.xbs/Sources/libressl/libressl-3.3/crypto/bio/bss_file.c:125:
8137630976:error:0EFFF072:configuration file routines:CRYPTO_internal:no such file:/AppleInternal/Library/BuildRoots/810eba08-405a-11ed-86e9-6af958a02716/Library/Caches/com.apple.xbs/Sources/libressl/libressl-3.3/crypto/conf/conf_def.c:200:


  👩‍🚀 WMR dev server running at:

  Local:   http://localhost:3301
  Network: (disabled, see --host)

This wouldn’t be a big issue if this call had not changed something which now prevents to connect to the server from Chrome and Safari (only Brave works), which prints a ERR_CONNECTION_REFUSED error.

Expected behavior

There are actually 3 points here:

  • Help users to set up https.
  • Help users with errors when enabling http2.
  • Make sure standard setup does not get broken in case of errors in the http2 setup.

Bug occurs with:

  • wmr or wmr start (development)
  • wmr build (production)
  • wmr serve

Desktop (please complete the following information):

  • OS: macOS 13.0.1
  • Browser: Chrome, Safari and Firefox fail, Brave works
  • Node Version: 16.18.1
  • WMR Version: 3.8.0

Additional context

I’m currently evaluating wmr to switch over our current React application, but am pretty much blocked by the leftovers from the http2 attempt. So I would much appreciate a way to clean up and get at least http access back.

Many thanks, Mike

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
rschristiancommented, Dec 5, 2022

Honestly, I’m not sure. It doesn’t seem that far-fetched to me that a browser would refuse a connection if it suspects some certificate tomfoolery going on (as unfortunately local HTTPS necessitates). I don’t really know enough about that.

Interesting also that (at least for the Firefox setup) brew is used, which means it should be installed (one cannot rely on that) and it’s broken on my M1 CPU, so I cannot use it anyway.

Indeed! Additionally, one of the reasons I’m not a fan of devcert is that it assumes Linux == Debian, which, er, is not an ideal assumption. I had to do a lot of patching originally to get it working on an Arch-based system: https://github.com/preactjs/wmr/issues/252#issuecomment-774637567

1reaction
rschristiancommented, Dec 5, 2022

Linux brain, I immediately jump to editing some config file or running the command in reverse 😃

AFAIK we don’t set any name or anything, just ask it to create a cert for the hostname. Any chance you just have the one for localhost?

https://github.com/preactjs/wmr/blob/729ed8a7fa8b418790fb4bf91c06d9eb36d31dce/packages/wmr/src/lib/http2.js#L6

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 the ERR_HTTP2_PROTOCOL_ERROR - Kinsta
For an HTTP/2 protocol error, something interrupts the communication between the HTTP application layer and a user's device. Unfortunately, this ...
Read more >
HTTP/2 Implementation Errors Exposing Websites to Serious ...
According to Kettle, a whole slew of security issues can surface when organizations fail to use HTTP/2 in an end-to-end fashion.
Read more >
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 >
Why Turning on HTTP/2 Was a Mistake - Lucidchart
In many cases moving to HTTP/2 is the right thing to do, but for some applications, HTTP/2 can cause significant problems.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found