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

Add prompt if user deploys a genkit function without a secret #8138

Merged
merged 3 commits into from
Jan 27, 2025

Conversation

inlined
Copy link
Member

@inlined inlined commented Jan 25, 2025

Redundant warning with the SDK after @taeold made a good point that the error isn't visible during deployment. Probably worth keeping the other one around anyway since this doesn't warn if the function already existed.

@inlined inlined requested a review from taeold January 25, 2025 02:02
Comment on lines 527 to 537
const msgBase =
`The function(s) ${newAndMissingSecrets.map((e) => e.id).join(", ")} use Genkit but do not have access to a secret. ` +
"This may cause the function to fail if it depends on an API key. To learn more about granting a function access to " +
"secrets, see https://firebase.google.com/docs/functions/config-env?gen=2nd#secret_parameters.";
if (options.nonInteractive) {
throw new FirebaseError(msgBase);
}
if (!(await prompt.confirm({ message: `${msgBase} Continue?` }))) {
throw new FirebaseError("Aborted");
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit* prompts.confirm has logic to short-circuit if nonInteractive is passed. So could be re-written to:

    logLabledBullet(msgBase);
    if (!(await prompt.confirm({ nonInteractive: options.nonInteractive, force: options.force }))) {
      throw new FirebaseError("Aborted");
    }

Slightly different behavior in messaging.

@inlined inlined merged commit 0b8e6ad into master Jan 27, 2025
44 of 46 checks passed
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.

2 participants