I am using Firebase Functions. I set a environment variable by command:
firebase functions:config:set my.token="abcde"
I verified it by command:
firebase functions:config:get
which returns me:
{
"my": {
"token": "abcde"
}
}
in my index.js , I try to get the set token by:
const tok = functions.config().my.token
I would like to test my functions locally instructed by this document, so I run command:
firebase serve --only functions
But it gives me error:
Error from emulator. FirebaseError: Error occurred while parsing your function triggers.
TypeError: Cannot read property 'token' of undefined
Why I can't access the token I set in environment variable of Firebase?