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.

runtimeConfig is empty in plugins

See original GitHub issue

Environment

  • Operating System: Linux
  • Node Version: v14.18.1
  • Nuxt Version: 2.16.0-27358576.777a4b7f
  • Package Manager: yarn@1.22.17
  • Builder: webpack
  • User Config: privateRuntimeConfig, publicRuntimeConfig, plugins, bridge, buildModules
  • Runtime Modules: -
  • Build Modules: @nuxt/bridge@3.0.0-27495976.e31c604

Reproduction

Old configuration: https://codesandbox.io/s/hardcore-dream-07bz0n?file=/nuxt.config.js
New configuration: https://codesandbox.io/s/peaceful-williamson-vddeiq?file=/nuxt.config.js

Describe the bug

I’ve just copied the example from https://github.com/nuxt/framework/pull/4254, created new plugin and page, which prints config values in console. It logs nothing in plugin (plugins/plugin.js) but outputs public values at runtime (see pages/index.js)

Additional context

No response

Logs

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
aldarundcommented, Jul 6, 2022

In old format plugins with $config from context it still dont work on client. On server its there but on client its not which breaks a lot of modules that coudl work https://codesandbox.io/s/immutable-fast-eypbmn?file=/plugins/plugin.js:0-33

2reactions
baixiaoyu2997commented, Apr 14, 2022

Checking against the latest version (v3.0.0-27497942.c519cee) it is fully compatible with both new and old syntax. Please check and ping to reopen if still having problems with runtimeConfig.

work for me, i use setup syntax

and i think runtimeConfig it’s just nitro only , when bridge : { nitro : false } ,will show error, It would be better if there was more detailed documentation or just tell users not to do this

Read more comments on GitHub >

github_iconTop Results From Across the Web

runtimeConfig is empty in plugins #9 - nuxt/bridge - GitHub
runtimeConfig is empty in plugins #9 ... It logs nothing in plugin (plugins/plugin.js) but outputs public values at runtime (see ...
Read more >
vue.js - Nuxt privateRuntimeConfig access inside Plugin
I created a .env file where i wrote my variables and made sure that is ignored in my .gitignore file. In nuxt.config.js I...
Read more >
Runtime Config · Nuxt Advanced
For this to work, you must have a fallback value (which can just be an empty string) defined in your nuxt.config . Example:...
Read more >
Systems Manager Command document plugin reference
Provides time zone information when no time zone information is included in your log's timestamp. If this parameter is left blank and if...
Read more >
next.config.js: Runtime Configuration
Place any server-only runtime config under serverRuntimeConfig . Anything accessible to both client and server-side code should be under publicRuntimeConfig ...
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