nuxt / nuxt/bridge

[h3] [unhandled] next is not a function

Open
#592 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

module
Dominant language
TypeScript
Stars
285
Forks
33
Avg merge
22h 38m
Merged PRs (30d)
3

Description

Environment
  • Operating System: Darwin
  • Node Version: v16.15.0
  • Nuxt Version: 2.15.8
  • Nitro Version: 0.6.0
  • Package Manager: npm@8.19.2
  • Builder: webpack
  • User Config: telemetry, env, server, nitro, loading, target, head, css, plugins, components, buildModules, modules, auth, oneSignal, fontawesome, i18n, axios, vWave, performance, build, buildDir, dir, webpack, serverHandlers, devServerHandlers, typescript, bridge
  • Runtime Modules: @nuxtjs/axios@5.13.6, @nuxtjs/auth-next@5.0.0-1648802546.c9880dc, @nuxtjs/i18n@7.3.0, @nuxtjs/onesignal@3.0.0-beta.16, @nuxtjs/color-mode@3.1.8, v-wave/nuxt
  • Build Modules: (), @nuxtjs/eslint-module@3.1.0, nuxt-compress@5.0.0, @nuxtjs/fontawesome@1.1.2, @nuxt/bridge@3.0.0-27778050.a725a7a
Reproduction

https://codesandbox.io/s/nuxt-bridge-bug-report-h3-rf0rw5

Describe the bug

Some modules like nuxt/sitemap ou nuxt/pwa generate this error: [h3] [unhandled] next is not a function with nitro 6.0.0.

This is probably due to last update of nitro to unjs/h3.

Note: this warning is show on the compilation of the app:
WARN [h3] Implicit event handler conversion is deprecated. Use eventHandler() or fromNodeMiddleware() to define event handlers.

Excuse if I miss something, it's my first issue that a report. I try to do it wright, and I hope you can fix it this issue 🙏. Thx for the amazing work.

Additional context

No response

Logs
ERROR  [h3] [unhandled] next is not a function                                                                                                               11:54:48

  at Object.serveStatic [as handler] (node_modules/serve-static/index.js:75:16)
  at Object.handler (node_modules/h3/dist/index.mjs:567:31)
  at processTicksAndRejections (node:internal/process/task_queues:96:5)
  at async toNodeHandle (node_modules/nuxi/dist/chunks/index2.mjs:879:7)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked CodeSandbox reproduction and the logged path through node_modules/serve-static/index.js, node_modules/h3/dist/index.mjs, and nuxi's toNodeHandle entry point. Trace how the Nuxt Bridge/Nitro handler reaches serve-static, then verify the reproduction no longer reports "next is not a function" or the related implicit-handler warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, nuxt
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.