Skip to content

Nuxt 4 & @nuxt/content v3.6.3. Cannot read properties of undefined (reading 'server') #3467

@Jordan-Ellis

Description

@Jordan-Ellis

Environment

  • Operating System: Darwin
  • Node Version: v22.14.0
  • Nuxt Version: 4.0.0
  • CLI Version: 3.26.2
  • Nitro Version: 2.12.0
  • Package Manager: [email protected]
  • Builder: -
  • User Config: compatibilityDate, devtools, modules, content
  • Runtime Modules: @nuxt/[email protected]
  • Build Modules: -

Version

v3.6.3

Reproduction

https://github.com/Jordan-Ellis/nuxt-content-restart-bug-reproduction/tree/master

  • Create a new nuxt project with bunx nuxi init, and install nuxt content
  • Set watch enabled to false
  • Make any change to the nuxt config while the server is running and it will crash.
  content: {
    watch: {
      enabled: false,
    }
  }

Description

When using nuxt 4 and nuxt content, the server crashes when making a change to the nuxt config file with this error:

Cannot restart nuxt: Cannot read properties of undefined (reading 'server')

 nuxt.hook("close", async () => {
    await websocket?.close();
    await listener.server.close(); // node_modules/@nuxt/content/dist/module.mjs:1683
  });

I have the watch.enabled option disabled for nuxt content. So at first glance it seems like the code isn't accounting for the web socket server to not exist.

Additional context

No response

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    v2Relevant for @nuxt/content v2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions