Description
[REQUIRED] Environment info
firebase-tools: 13.0.1
Platform: macOS
[REQUIRED] Test case
firebase init hosting
echo 'export X=y' > ./hosting/.env.test
firebase deploy
[REQUIRED] Steps to reproduce
Create a firebase project with Next.js hosting. Use export
in .env
, then try to deploy via firebase deploy
.
It's not totally clear to me if having a "test" alias for the firebase project is relevant to .env.test
getting picked up, but I'll mention it in case it is.
[REQUIRED] Expected behavior
Firebase successfully deploys, either ignoring .env.test
, or at least parsing it without crashing.
[REQUIRED] Actual behavior
Firebase complains that export
is not valid syntax, which is incorrect. Basically every other dotenv parser implementation supports each line being prefixed by the word export
, which allows users to source that file in their shell of choice without modification during local testing.
Actual output looks like this:
=== Deploying to 'my-project-4867'...
i deploying functions, hosting
i functions: preparing codebase firebase-frameworks-my-project-4867 for deployment
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
i artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
✔ functions: required API cloudbuild.googleapis.com is enabled
✔ functions: required API cloudfunctions.googleapis.com is enabled
✔ artifactregistry: required API artifactregistry.googleapis.com is enabled
i functions: Loading and analyzing source code for codebase firebase-frameworks-my-project-4867 to determine what to deploy
Serving at port 8221
Error: Failed to load environment variables from .env.test.:
- FirebaseError Invalid dotenv file, error on lines: export X=y
Link to relevant parser code: https://github.com/firebase/firebase-tools/blob/master/src/functions/env.ts#L114-L149