-
Notifications
You must be signed in to change notification settings - Fork 210
How to pass GOOGLE_GENAI_API_KEY when using onFlow()
#1586
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
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
@kevinthecheung is this just a docs gap or does it look like a Genkit bug? @mbleigh maybe related to #1567? |
Hi @gregfenton. It looks like the flow you defined isn't bound to the secret:
See the documentation for more info. It's a common footgun, and I wish there was a more intuitive way to bind secrets to functions. If you have any idea, please let us know. (FWIW, this issue is unrelated to #1567) |
@taeold I added that line to the onFlow() parameters, but that leads to the error:
Seems that TS is telling the truth. FYI: I use Cloud Functions and Secrets Manager daily. It is Is there reference documentation for |
@gregfenton Based on https://github.com/firebase/genkit/blob/main/js/plugins/firebase/src/functions.ts#L51, it looks like the correct syntax might be:
Do you mind giving this a try? Refernce docs would be nice, and I expect them to be incoming! |
@taeold That totally fixed it! 🥳 Wasn't obvious to me that Wait....OMG....was this there the whole time? Please tell me this was the Firebase Genkit team just being super responsive and not that I totally can't read/messed up???!!! 🫣 |
Related issues
Possibly #1567
[REQUIRED] Version info
node:
18.20.2
firebase-functions:
5.0.1
firebase-tools:
13.13.2
firebase-admin:
─ [email protected]
─ [email protected]
─ [email protected]
─ @genkit-ai/[email protected]
─ @genkit-ai/[email protected]
[REQUIRED] Test case
Cloud Functions code:
[REQUIRED] Steps to reproduce
Follow steps from Deploy a flow as a Cloud Function but replace code in
functions/src/index.ts
with:[REQUIRED] Expected behavior
Running web client app returns a generated list of restaurant menu items.
[REQUIRED] Actual behavior
Error is logged to browser's JS Console:
In Logs Explorer I get the error:
Were you able to successfully deploy your functions?
Yes, they deployed fine. And the function
testApiKey
when called from the same HTML client runs fine and displays the proper API key value from the Secrets Manager.The text was updated successfully, but these errors were encountered: