0

I'm keeping the key value. The boot is giving me this error.

My code works fine if I don't use env variables, but I get this error when I use env variables.

.env.local code :

API_KEY=AIzaSyBPDUsNpEspYB-b_q8YUemjg8mp26BJCn0
AUTH_DOMAIN=phonesy-ad56a.firebaseapp.com
PROJECT_ID=phonesy-ad56a
STORAGE_BUCKET=phonesy-ad56a.appspot.com
MESSAGIBG_SENDER_ID=304429202901
APP_ID=1:304429202901:web:9b3c2fab35b3c4f36c115c

firebase init code :

apiKey: process.env.API_KEY,
authDomain: process.env.AUTH_DOMAIN,
projectId: process.env.PROJECT_ID,
storageBucket: process.env.STORAGE_BUCKET,
messagingSenderId: process.env.MESSAGIBG_SENDER_ID,
appId: process.env.APP_ID,
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/0.14.0/react-dom.min.js"></script>
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • Please trim your code to make it easier to find your problem. Follow these guidelines to create a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). – treckstar May 02 '22 at 03:37

1 Answers1

0

Firstly, do not expose your keys. Edit: Firebase configuration values are not sensitive.

The problem is, you are using ".env.local". That is for local environment variables.

Rename your file to ".env", restart your server. Or create new file named ".env"

Emre A
  • 240
  • 1
  • 6
  • "do not expose your keys" Firebase configuration values are not your typical keys, so I recommend reading: https://stackoverflow.com/questions/37482366/is-it-safe-to-expose-firebase-apikey-to-the-public. That said, I'd still typically not include them in my Stack Overflow questions and answer, but that is because they're not needed there. – Frank van Puffelen May 02 '22 at 01:47