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.

Nuxt development server continiously restarts with `--https`

See original GitHub issue

Environment

------------------------------
- Operating System: `Darwin`
- Node Version:     `v16.11.1`
- Nuxt Version:     `3.0.0-27274229.29599f0`
- Package Manager:  `npm@8.1.3`
- Bundler:          `Vite`
- User Config:      `publicRuntimeConfig`, `ssr`, `target`, `meta`, `build`, `css`, `buildModules`
- Runtime Modules:  `-`
- Build Modules:    `-`
------------------------------

Describe the bug

the development server seems to restart all the time

Reproduction

steps:

  • install fresh project with nuxi init
  • generate ssl key and certificate
  • updated dev script to nuxi dev --host domain.test --https --ssl-key key.pem --ssl-cert cert.pem

Additional context

A similar issue has been described here: https://github.com/nuxt/framework/issues/1697 recreating the pkg lock and/or adding the std-env package does not help

Logs

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:34 (21 by maintainers)

github_iconTop GitHub Comments

9reactions
vicvillaloboscommented, Apr 28, 2022

I have a Docker stack and an Nginx reverse proxy in it, which proxy pass “/” to “http://client:3000” when i visit https://web.localhost domain. So…

If I use Nuxt3 without Docker and reverse proxy, go to http://localhost:3000, nuxt.config vite->server->hmr is loaded properly 👍🏼. If I go to https://web.localhost vite->server->hmr options are ignored! 👎🏼 😢

Some idea?

In case anyone stumbles upon this issue, I solved it by exposing the 24678 port on docker.

9reactions
dbhagencommented, Nov 10, 2021

Actually, the more I thought about it, the thing that was missing was redirecting to the right host for WebSocket. I was able to resolve the error using this in the nuxt.config.ts:

import { defineNuxtConfig } from 'nuxt3'

// https://v3.nuxtjs.org/docs/directory-structure/nuxt.config
export default defineNuxtConfig({
  vite: {
    server: {
      hmr: {
        protocol: 'ws',
        host: 'localhost'
      }
    }
  }
})

Still seems like there’s an error when Caddy (or the HTTPS flag) tries to proxy the WebSocket back. But at least for now, this is a workaround.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nuxt application local development server constantly reloading
I have a Nuxt ^2.15. 8 application which is constantly reloading after I run yarn dev . The console will show a message...
Read more >
Vue and Nuxt Performance Optimization Checklist
Read the comprehensive and in-depth technical article summarizing how to improve the site performance with efficient use of Vue.js and Nuxt.
Read more >
Creating Server-side Rendered Vue.js Apps Using Nuxt.js
This is a big indication that something is wrong with the application logic. Thankfully, an error will be generated in your browser's console...
Read more >
Continuous Integration and deployment with Jenkins and ...
Once that is done, change the origin of the Github repository from HTTPS to SSH. Then log in to the development Server and...
Read more >
How to Configure SSG and SSR on Nuxt.js - Mad Devs
Storing; SSG; SSR. Separately, I will show you how to set up SSG, SSR in production and create your own API using nuxt...
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