firebase / firebase-functions

Firebase SDK for Cloud Functions
https://firebase.google.com/docs/functions/
MIT License
1.01k stars 201 forks source link

Inconsistend behaviour of defineList in deploy/emulator #1523

Closed dee-gmiterko closed 2 months ago

dee-gmiterko commented 4 months ago

Related issues

[REQUIRED] Version info

node:

v20.10.0

firebase-functions:

4.7.0

firebase-tools:

12.5.2

firebase-admin:

12.0.0

[REQUIRED] Test case

index.js

import { defineList } from "firebase-functions/params";

const listParam = defineList("LIST");

console.log(listParam.value());

.env

LIST=["a", "b", "c"]

[REQUIRED] Expected behavior

To have defineList behavior be consistent across emulator and production, and documented.

[REQUIRED] Actual behavior

defineList parses value in .env file differently causing it to became ['["a"', '"b"', '"c"]'].

Were you able to successfully deploy your functions?

Yes, but behaves unexpectedly.

google-oss-bot commented 4 months ago

I found a few problems with this issue:

exaby73 commented 2 months ago

Hey @dee-gmiterko. It's not recommended to use the value of a param outside of a function. Does this reproduce within a function? If you require to access the value to initialize anything before running the actual functions, you can use the new onInit function for this purpose

google-oss-bot commented 2 months ago

Hey @dee-gmiterko. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 2 months ago

Since there haven't been any recent updates here, I am going to close this issue.

@dee-gmiterko if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.