Skip to content

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

Merged
inlined merged 3 commits into
masterfrom
inlined.genkit-secrets-warn
Jan 27, 2025
Merged

Add prompt if user deploys a genkit function without a secret#8138
inlined merged 3 commits into
masterfrom
inlined.genkit-secrets-warn

Conversation

@inlined

@inlined inlined commented Jan 25, 2025

Copy link
Copy Markdown
Member

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 thread src/deploy/functions/prepare.ts Outdated
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
Copy Markdown
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
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