Closed
Description
[REQUIRED] Environment info
firebase-tools: 11.20.0
firebase-functions: 4.1.1
Platform: macOS, Debian
[REQUIRED] Test case
- Initialize Firebase project with functions only,
- update firebase-admin and
firebase-functions
, - ensure there is
functions/.env.<projectId>
file with the contentsRANDOM_FLOAT=0.2
, - replace
functions/index.js
contents with:
const functions = require("firebase-functions");
const { defineFloat } = require("firebase-functions/params");
const randomFloat = defineFloat("RANDOM_FLOAT");
exports.helloWorld = functions.https.onRequest((request, response) => {
functions.logger.info(process.env);
response.send(`Random float: ${randomFloat.value()}`);
});
[REQUIRED] Steps to reproduce
Deploy the above function.
[REQUIRED] Expected behavior
Logs should show env object with RANDOM_FLOAT:"0.2"
and response should be Random float: 0.2
.
[REQUIRED] Actual behavior
Logs show env object with RANDOM_FLOAT:"[\"1.0\"]"
(a JSON array instead of float) and response is Random float: 0
.