nuxt/cli

`nuxi dev --tunnel` together with `--html` results in `502 Bad Gateway`

madebyfabian opened this issue · 4 comments

Hi there! I had HTTPS configured for a while now, and used the following command:

nuxi dev  --https --ssl-cert localhost.pem --ssl-key localhost-key.pem

Now I wanted to start it with a tunnel too, so that I have a https localhost + a tunnel. So when adding the option

nuxi dev  --https --ssl-cert localhost.pem --ssl-key localhost-key.pem --tunnel

The tunnel starts, but when visiting the trycloudflare.com url, it results in

502 Bad Gateway
An error occurred while opening a stream to the origin.

Reproduction

Would have loved to provide one, but it seems like StackBlitz doesn't support generating SSL certificates, it results in

 ERROR  n.run is not a function 
  at Object.generateKeyPair (https://github4an5se-jb1n.w-credentialless.staticblitz.com/blitz.6854296d.js:94:1229)
  at pki$4.rsa.generateKeyPair (node_modules/nuxi/dist/chunks/index2.mjs:13806:24)
  at https://github4an5se-jb1n.w-credentialless.staticblitz.com/blitz.6854296d.js:37:1893
  at new Promise (<anonymous>)
  at bound  (https://github4an5se-jb1n.w-credentialless.staticblitz.com/blitz.6854296d.js:37:1746)
  at generateKeyPair (node_modules/nuxi/dist/chunks/index2.mjs:29646:16)
  at generateCert (node_modules/nuxi/dist/chunks/index2.mjs:29655:25)
  at generateCACert (node_modules/nuxi/dist/chunks/index2.mjs:29593:16)
  at generateCertificates (node_modules/nuxi/dist/chunks/index2.mjs:29487:20)
  at resolveCertificate (node_modules/nuxi/dist/chunks/index2.mjs:29468:28) 

tried it out at https://stackblitz.com/edit/github-4an5se

My current workaround is to just have two seperate scripts in package.json, one for starting a tunnel without https, and one for starting the devserver with https but without a tunnel

Try setting up the tunnel again. For me, it never works on the first try - also tracked in unjs/untun#10

@manniL Thanks, oh yeah, trying it again solves it :D Sometimes it's the simplest things. Should I close this than in favour of unjs/untun#10?

Yep, let's do that!