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

Load secrets when emulating functions with --inspect-function flag #5308

Merged
merged 2 commits into from
Dec 7, 2022

Conversation

joehan
Copy link
Contributor

@joehan joehan commented Dec 7, 2022

Description

Load secrets when emulating functions with --inspect-function flag. Fixes #4605 and #5062

Scenarios Tested

Tested that extensions and CF3 codebases correctly load secrets, both with and without the --inspect-functions flag.

@joehan joehan requested a review from taeold December 7, 2022 18:04
Copy link
Contributor

@taeold taeold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

Comment on lines +662 to +669
toSetup.reduce(
(acc: Record<string, backend.SecretEnvVar>, curr: EmulatedTriggerDefinition) => {
for (const secret of curr.secretEnvironmentVariables || []) {
acc[secret.key] = secret;
}
return acc;
},
{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(no action required) ohhh reduce is so hard for me. I think I always just end up writing a for loop.

@joehan joehan merged commit 97ce550 into master Dec 7, 2022
@joehan joehan deleted the jh-sequential-secrets branch December 7, 2022 18:22
@gbourne1
Copy link

gbourne1 commented Jan 2, 2023

Secrets are loaded at emulator startup with the " --inspect-functions" flag, but hot reloads (changing the code and watch reloads) cause the secrets to return to undefined. The emulator needs to then be restarted for the secrets to load again. @joehan

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

Successfully merging this pull request may close these issues.

Functions cannot access Firebase Secrets, when i debug (inspect) mode
3 participants