You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Only a specially-named environment variable can override a runtime config property. That is, an uppercase environment variable starting with NUXT_ which uses _ to separate keys and case changes.
First, you have to add a check to make sure that the secondary value exists at all.
If you make a mistake in naming the ENV variable due to carelessness, the entire application will crash in production, but will work in any version locally.
This happens because there is a .env file locally. In production, .env is not recommended and you need to use environment variables.
Since your primary source of the value is the runtime config variables, the module settings are erased with an empty value from the runtime config. This is an error, since the environment variable should in principle be optional, and if it is present, the value of the module settings is replaced. And if there is no environment variable, the setting from the module configuration should be taken.
Nuxt has a very confusing system of ENV variables. When a variable is defined in the runtime config like this
First, you have to add a check to make sure that the secondary value exists at all.
nuxt-gtm/src/module.ts
Line 44 in 511b9bf
If you make a mistake in naming the ENV variable due to carelessness, the entire application will crash in production, but will work in any version locally.
This happens because there is a .env file locally. In production, .env is not recommended and you need to use environment variables.
Since your primary source of the value is the runtime config variables, the module settings are erased with an empty value from the runtime config. This is an error, since the environment variable should in principle be optional, and if it is present, the value of the module settings is replaced. And if there is no environment variable, the setting from the module configuration should be taken.
Nuxt has a very confusing system of ENV variables. When a variable is defined in the runtime config like this
Then the environment variable should be
NUXT_PUBLIC_GTM_ID=GTM-QWERTY0
A typo in the naming of an environment variable should not crash the production. Your module in its current form is dangerous :)
The text was updated successfully, but these errors were encountered: