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-bridge useNuxtApp() not available inside middleware

See original GitHub issue

Environment


  • Operating System: Darwin
  • Node Version: v16.15.0
  • Nuxt Version: 2.16.0-27616340.013f051b
  • Package Manager: yarn@3.2.1
  • Builder: webpack
  • User Config: srcDir, bridge, ssr, dev, webpackOptimisations, alias, image, generate, head, typescript, publicRuntimeConfig, privateRuntimeConfig, css, loading, loadingIndicator, plugins, components, buildModules, modules, proxy, axios, vuetify, build, serverHandlers, devServerHandlers
  • Runtime Modules: @nuxtjs/vuetify@1.12.3, @nuxt/image@0.6.2, @nuxtjs/axios@5.13.6, @nuxtjs/proxy@2.1.0, nuxt-social-meta@1.0.0
  • Build Modules: (), nuxt-storm@1.1.3, nuxt-compress@5.0.0, nuxt-webpack-optimisations@2.2.4, @pinia/nuxt@0.3.0, @nuxt/bridge@3.0.0-27636329.42ea75b

Reproduction

image

Describe the bug

useNuxtApp() inside a middleware fails with an error image

Additional context

No response

Logs

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
antlionguardcommented, Jul 22, 2022

Can you share minimal reproduction or middleware code?

1reaction
stephenjason89commented, Aug 27, 2022

@Luferov yeah, let’s wait and hope for a fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

nuxtApp availability in nuxt 2 middleware · Issue #48 - GitHub
Hi, sorry is not for API Middleware, I was talking about Nuxt-Bridge and route middleware (nuxt 2).
Read more >
Nuxt 2 Bridge: How to set a middleware on a page?
In Nuxt 2 Bridge middlewares are still set the old non-composition way. This can be used next to the composition API:
Read more >
Migrate to Bridge: Composition API - Nuxt
Nuxt Bridge provides access to Composition API syntax. ... In order to access Vuex store instance, you can use useNuxtApp().$store .
Read more >
What's new in Nuxt 3 - LogRocket Blog
While there is currently no stable migration technique for a smooth transition from Nuxt 2 to Nuxt 3, Nuxt Bridge (which we will...
Read more >
Middleware directory - Nuxt
The middleware will be executed in series in this order: nuxt.config.js (in the order within the file); Matched layouts; Matched pages. Router Middleware....
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