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
Describe the bug
The fb.js file in Helpers Directory can be seen importing variables from .env file. But the command process.env.GENERAL_VARIABLE_NAME seems to not be working and The app when cloned and custom environment variables(APP_ID, API_KEY etc) are inserted into the .env file. The file doesn't recognises the input variables and are set to undefined as a result due to the || operator the default variables are used for building the repo(which passes and app runs on a local environment)
(for example apiKey is set to "AIzaSyCMsFreESs58-hRxTtiqQrIcimh4i1wbsM" in .env file)
To Reproduce
Steps to reproduce the behavior:
Fill the .env file with custom variables(After making a project on firebase and copying the configurations)
Expected behaviour
Now Assuming the .env file is filled correctly, The app should intake the variables from the .env file(despite of the removal of the defaults) and show the HomeScreen on localhost(like this)
Seen behaviour -
The app after successful compilation gets stuck on the loading when the defaults are removed
Tested on
OS: [MacOS High Sierra]
Browser [chrome]
Version [Chrome Version - 90]
Additional context
I actually found about this bug when I was also trying to import the environment variables for a Nuxt App and it kept showing undefined for API_KEY(When Client Side rendered) and the actual value(When Server Side Rendered) through console.log()
Solution
I also found a solution to this bug and it lies in @nuxt/dotenv module, which requires a little bit of tweaking to the nuxt.config.js. Just wanted to discuss it first with the collaborators to make sure that this is a valid issue before a pull request is made for fixing this
The text was updated successfully, but these errors were encountered:
bhavukkalra
changed the title
The Build Not accepting the custom Environment Variables and building on defaults
The Build Not accepting the custom Environment Variables but building on defaults
May 14, 2021
Runtime congif has in-built dotenv support. This error might've been introduced in any latest version bumps of the dependency. We're working on a fix. Thanks for your patience.
Hi @bhavukkalra, we've pushed a fix along with a rollback to the @nuxt/dotenv package. The .env file from the root directory and or environment variables defined in hosting providers like Netlify, Vercel, etc should work now.
You can find a sample .env.example file in the root directory with our default environment keys. Rename this file to .env and replace its values with your Firebase config, GTM, and GA keys.
Describe the bug
The
fb.js
file in Helpers Directory can be seen importing variables from.env
file. But the commandprocess.env.GENERAL_VARIABLE_NAME
seems to not be working and The app when cloned and custom environment variables(APP_ID, API_KEY etc) are inserted into the .env file. The file doesn't recognises the input variables and are set toundefined
as a result due to the||
operator the default variables are used for building the repo(which passes and app runs on a local environment)(for example
apiKey
is set to"AIzaSyCMsFreESs58-hRxTtiqQrIcimh4i1wbsM"
in .env file)To Reproduce
Steps to reproduce the behavior:
with this(i.e removing all the default variables)
Expected behaviour
![Screenshot 2021-05-14 at 10 29 15 PM](https://user-images.githubusercontent.com/41142068/118304135-e8c9ca00-b503-11eb-9f37-d5b92516b481.png)
Now Assuming the .env file is filled correctly, The app should intake the variables from the
.env
file(despite of the removal of the defaults) and show the HomeScreen on localhost(like this)Seen behaviour -
![Screenshot 2021-05-14 at 10 12 45 PM](https://user-images.githubusercontent.com/41142068/118302637-1746a580-b502-11eb-86cc-7ac96a6274b2.png)
The app after successful compilation gets stuck on the loading when the defaults are removed
Tested on
Additional context
I actually found about this bug when I was also trying to import the environment variables for a Nuxt App and it kept showing
undefined
for API_KEY(When Client Side rendered) and the actual value(When Server Side Rendered) throughconsole.log()
Solution
I also found a solution to this bug and it lies in
@nuxt/dotenv
module, which requires a little bit of tweaking to thenuxt.config.js
. Just wanted to discuss it first with the collaborators to make sure that this is a valid issue before a pull request is made for fixing thisThe text was updated successfully, but these errors were encountered: