Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistend behaviour of defineList in deploy/emulator #1523

Closed
dee-gmiterko opened this issue Feb 14, 2024 · 4 comments
Closed

Inconsistend behaviour of defineList in deploy/emulator #1523

dee-gmiterko opened this issue Feb 14, 2024 · 4 comments

Comments

@dee-gmiterko
Copy link

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"]
  • When running function in emulator listParam.value() returns ["a", "b", "c"]
  • However after deployment it would return ['["a"', '"b"', '"c"]'] not parsing JSON, but splitting on commas
  • I was also unable to decide which behavior is correct as I wasn't able to locate documentation stating either one is correct.

[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
Copy link
Collaborator

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@exaby73
Copy link
Contributor

exaby73 commented Apr 18, 2024

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

@exaby73 exaby73 added Needs: Author Feedback Issues awaiting author feedback and removed needs-triage labels Apr 18, 2024
@google-oss-bot
Copy link
Collaborator

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
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants