joshpetit
joshpetit

Reputation: 899

Firebase Error on Deploy, "HOST starts with a reserved prefix" with .env file

Firebase deploys have always worked in the past, but today when I tried deploying after making a simple update to my rules and a few functions, I receive this error:

Error: Failed to load environment variables from .env.:
- Error Key FIREBASE_AUTH_EMULATOR_HOST starts with a reserved prefix (X_GOOGLE_ FIREBASE_ EXT_)
- Error Key FIREBASE_STORAGE_EMULATOR_HOST starts with a reserved prefix (X_GOOGLE_ FIREBASE_ EXT_)
- Error Key GCLOUD_PROJECT is reserved for internal use.

This is the entire context of the error:

✔  functions: Finished running predeploy script.
i  firebase.storage: checking storage.rules for compilation errors...
✔  firebase.storage: rules file storage.rules compiled successfully
i  firestore: reading indexes from firestore.indexes.json...
i  cloud.firestore: checking firestore.rules for compilation errors...
✔  cloud.firestore: rules file firestore.rules compiled successfully
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
✔  functions: required API cloudfunctions.googleapis.com is enabled
✔  functions: required API cloudbuild.googleapis.com is enabled
Error: Failed to load environment variables from .env.:
- Error Key FIREBASE_AUTH_EMULATOR_HOST starts with a reserved prefix (X_GOOGLE_ FIREBASE_ EXT_)
- Error Key FIREBASE_STORAGE_EMULATOR_HOST starts with a reserved prefix (X_GOOGLE_ FIREBASE_ EXT_)
- Error Key GCLOUD_PROJECT is reserved for internal use.

I have a .env file I use within my tests to point to where the emulators are, this is it:

FIRESTORE_EMULATOR_HOST='0.0.0.0:8080'
FIREBASE_AUTH_EMULATOR_HOST='0.0.0.0:9099'
FIREBASE_STORAGE_EMULATOR_HOST='0.0.0.0:9099'
GCLOUD_PROJECT='PROJECTNAME'

Is there a reason why this is only now causing an error? When I remove it and deploy it works.

Upvotes: 2

Views: 1549

Answers (1)

Juan Jose Ruiz Soto
Juan Jose Ruiz Soto

Reputation: 86

You only need to change the name of the environment variables. change FIREBASE_DATABASE_URL to FB_DATABASE_URL

Upvotes: 7

Related Questions