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.

h3 Error in Nuxt 3.0.0-rc.12

See original GitHub issue
 WARN  [h3] Implicit event handler conversion is deprecated. Use eventHandler() or fromNodeMiddleware() to define event handlers.                                                                                                                          23:19:22
     Route: /_nuxt/ 
     Handler: function serveStatic (req, res, next) {
    if (req.method !== 'GET' && req.method !== 'HEAD') {
      if (fallthrough) {
        return next()
      }

      // method not allowed
      res.statusCode = 405
      res.setHeader('Allow', 'GET, HEAD')
      res.setHeader('Content-Length', '0')
      res.end()
      return
    }

    var forwardError = !fallthrough
    var originalUrl = parseUrl.original(req)
    var path = parseUrl(req).pathname

    // make sure redirect occurs at mount
    if (path === '/' && originalUrl.pathname.substr(-1) !== '/') {
      path = ''
    }

    // create send stream
    var stream = send(req, path, opts)

    // add directory handler
    stream.on('directory', onDirectory)

    // add headers listener
    if (setHeaders) {
      stream.on('headers', setHeaders)
    }

    // add file listener for fallthrough
    if (fallthrough) {
      stream.on('file', function onFile () {
        // once file is determined, always forward error
        forwardError = true
      })
    }

    // forward errors
    stream.on('error', function error (err) {
      if (forwardError || !(err.statusCode < 500)) {
        next(err)
        return
      }

      next()
    })

    // pipe
    stream.pipe(res)
  }
 ERROR  [h3] [unhandled] next is not a function                                                                                                                                                                                                            23:20:12  

  at Object.serveStatic [as handler] (node_modules\serve-static\index.js:75:16)
  at Object.handler (/C:/Users/USER/Desktop/Folder/Code/littlechildwriter/node_modules/h3/dist/index.mjs:634:31)
  at runMicrotasks (<anonymous>)
  at processTicksAndRejections (node:internal/process/task_queues:96:5)
  at async toNodeHandle (/C:/Users/USER/Desktop/Folder/Code/littlechildwriter/node_modules/nuxi/dist/chunks/index2.mjs:879:7)

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dougwilsoncommented, Oct 29, 2022

Thank you! I will take a look when I get back next week. If you can determine the code change in the meantime, feel free to open a pull request.

1reaction
dougwilsoncommented, Oct 29, 2022

Ok. But unless I’m missing something from that changelog, it’s not the Express.js middleware that needs to change. You’re always welcome to make a pull request with the fix if there is something I am missing and it needs fixing in the code of this module or you can provide a reproduction case as request above and I’d be happy to take a look.

Read more comments on GitHub >

github_iconTop Results From Across the Web

v3.0.0-rc.12 · Discussion #8296 · nuxt/framework
0-rc.12 , so tired updating to edge release but then I started getting another 500 error: injection "Symbol(route location)" not found.
Read more >
Nuxt 3 + Pinia : [h3] [unhandled] H3Error ...
When installing the pinia package via npm i pinia , I got a bunch of errors, similar to what's described here.
Read more >
vite_ssr_import_0__.defineStore is not a function : r/Nuxt
Solution : Use the "pinia" package as a normal dependency, and the "@pinia/nuxt" package as a dev dependency. I found ...
Read more >
Add a headless CMS to Nuxt 3 in 5 minutes
The project in this tutorial and its subsequent parts was developed using the following versions: nuxt@3.0.0-rc.12; @storyblok/nuxt@4.2.2.
Read more >
Nuxt 3 Deploy Failed: Rollup failed to resolve import "vue"
Hi all, I've been trying to deploy a Nuxt 3 app for the past few hours, ... 9:33:12 AM: [log] Nuxt 3.0.0-rc.12 with...
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