Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading to v3.4.0 breaks runtimeConfig #20226

Closed
mtdvlpr opened this issue Apr 12, 2023 · 2 comments
Closed

Upgrading to v3.4.0 breaks runtimeConfig #20226

mtdvlpr opened this issue Apr 12, 2023 · 2 comments

Comments

@mtdvlpr
Copy link

mtdvlpr commented Apr 12, 2023

Environment


  • Operating System: Linux
  • Node Version: v18.15.0
  • Nuxt Version: 3.4.0
  • Nitro Version: 2.3.3
  • Package Manager: yarn@3.5.0
  • Builder: vite
  • User Config: srcDir, ssr, telemetry, typescript, build, imports, router, sourcemap, modules, i18n, vite, runtimeConfig
  • Runtime Modules: @nuxtjs/i18n@8.0.0-beta.10, @vueuse/nuxt@9.13.0, nuxt-lodash@2.4.1, @pinia/nuxt@0.4.8, nuxt-electron@0.4.5, ()
  • Build Modules: -

Reproduction

https://stackblitz.com/edit/github-eky4to?file=app.vue

Describe the bug

With ssr: false, the useRuntimeConfig() breaks somehow. I get an error and the entire application is not rendered.

Additional context

It has to do with these lines:

const runtimeConfig = process.server ? options.ssrContext.runtimeConfig : reactive(nuxtApp.payload.config);
  const compatibilityConfig = new Proxy(runtimeConfig, {
    get(target, prop) {
      if (prop in target) {
        return target[prop];
      }
      if (process.dev && prop in target.public) {
        console.warn(`[nuxt] [runtimeConfig] You are trying to access a public runtime config value (\`${prop}\`) directly from the top level. This currently works (for backward compatibility with Nuxt 2) but this compatibility layer will be removed in v3.5. Instead, you can update \`config['${prop}']\` to \`config.public['${prop}']\`.`);
      }
      return target.public[prop];
    },
    set(target, prop, value) {
      if (process.server || prop === "public" || prop === "app") {
        return false;
      }
      target[prop] = value;
      target.public[prop] = value;
      return true;
    }
  });

Logs

Error while mounting app: TypeError: `target` argument of Proxy must be an object, got undefined
@mtdvlpr mtdvlpr changed the title Upgrading to v3.4.0 breaks publicRuntimeConfig Upgrading to v3.4.0 breaks runtimeConfig Apr 12, 2023
@danielroe
Copy link
Member

This should be resolved in the edge channel via #20216, or in the next release.

Let me know if not and I'll reopen.

@danielroe danielroe closed this as not planned Won't fix, can't repro, duplicate, stale Apr 12, 2023
@vinayakkulkarni
Copy link

Duplicate of #20212

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants