I'm running an update of a Firebase functions project.
Environment variables was managed with runtime environment configuration (functions.config). Regarding the recommended way in Firebase documentation, i choosed to used file-based configuration of environment variables with dotenv file format.
1 - I ran firebase functions:config:export and
4 dotenv files was created in the functions/ folder.
.env.default
.env.
.env.dev
.env.local
.env file:
# Exported firebase functions:config:export command on 24/02/2022`
MAILJET_KEY="XXXX"
MAILJET_SECRET="XXXX"
STRAVA_SECRET="XXXX"
STRAVA_ID="XXXX"
2 - I updated the source code to manage process.env.MY_VARIABLE
const mailjet = require('node-mailjet').connect(process.env.MAILJET_KEY, process.env.MAILJET_SECRET);
3 - I ran npm run serve or deploy the function but process.env.MY_VARIABLE return undefined
Error: Mailjet API_KEY is required
**Do i run a something special to migrate from functions.config to process.env ??? **
Note: I've recently managed process.env iin a new project and it's works fine !
Thx