firebase-functions icon indicating copy to clipboard operation
firebase-functions copied to clipboard

defineSecret creates a list of values in Secret Manager

Open jtmuller5 opened this issue 1 month ago • 7 comments

Related issues

[REQUIRED] Version info

node: v20.13.1

firebase-functions: ^5.0.0

firebase-tools:

firebase-admin: 13.9.0

[REQUIRED] Test case

Original Stack Overflow question: https://stackoverflow.com/a/78496117/12806961

[REQUIRED] Steps to reproduce

  1. Create a new Firebase Genkit project (firebase init genkit)
  2. export GOOGLE_GENAI_API_KEY={key}
  3. Add these lines at the top of the file:
import { defineSecret } from "firebase-functions/params";
defineSecret("GOOGLE_GENAI_API_KEY");
  1. Run firebase deploy --only functions
  2. Navigate to GCP > Cloud Functions > Functions > Select Function > Variables Tab

The GOOGLE_GENAI_API_KEY variable is a list, not a string.

[REQUIRED] Expected behavior

DefineSecret should create a single string environment variable and not a list with a single string value.

[REQUIRED] Actual behavior

image

Were you able to successfully deploy your functions?

Yes but it didn't work. I needed to change defineSecret to defineString.

jtmuller5 avatar May 17 '24 18:05 jtmuller5