1

i'm trying to add my firebase option to .env variables add add those in my firebase config and they run ok without any error in console on local host but when it's deployed it to netlify it throws error this error in console projectId must be a string in FirebaseApp.options i dont know what i'm doing wrong here. i tried adding project id in template string so i can use the .env variable and i checked the type of process.env.VUE_APP_PROJECTID is string but it still throw that error.i can provide more details if needed and i'm using it in vue.js

.env file

VUE_APP_APIKEY="***********"
VUE_APP_AUTHDOMAIN= "***********"
VUE_APP_DATABASEURL = "***********"
VUE_APP_PROJECTID ="***********"
VUE_APP_STORAGEBUCKET = "***********"
VUE_APP_MESSAGINGSENDERID ="***********"
VUE_APP_APPID="***********"

firebase config object in main.js

var firebaseConfig = {
  apiKey: process.env.VUE_APP_APIKEY,
  authDomain: process.env.VUE_APP_AUTHDOMAIN,
  databaseURL: process.env.VUE_APP_DATABASEURL,
  projectId: `${process.env.VUE_APP_PROJECTID}`,
  storageBucket: process.env.VUE_APP_STORAGEBUCKET,
  messagingSenderId: process.env.VUE_APP_MESSAGINGSENDERID,
  appId: process.env.VUE_APP_APPID
};
Tanner
  • 2,232
  • 13
  • 22
Naveen Kashyap
  • 372
  • 1
  • 9
  • Looks like Netlify only reads env variables from its own configuration file: https://stackoverflow.com/questions/56245552/variables-stored-in-env-file-not-loading-in-production-build-in-netlify – yuriy636 Dec 18 '19 at 22:08
  • the main problem is netlify is caching my site and wont update it after deploying it. it shows the older vresion of site – Naveen Kashyap Dec 19 '19 at 09:54

0 Answers0