Hello everyone,
I’m hoping someone in the community can spot what I’m missing. I have a project where a Cloud Function is unable to access the Gemini Pro model and I’ve hit a wall after trying all the standard troubleshooting steps.
My Goal:
I have a Firestore trigger (onDocumentCreated) in the me-west1 region. This trigger should execute a Cloud Function in us-central1 that calls the Gemini API to generate content.
The Problem:
The function triggers and runs correctly, but the call to generativeModel.generateContent() fails with a 404 Not Found error.
Here is the exact error log:
codeCode
Publisher Model `projects/[YOUR_PROJECT_ID]/locations/us-central1/publishers/google/models/gemini-1.0-pro` was not found or your project does not have access to it.
What I’ve Already Done:
-
Project/API: The Vertex AI API is enabled and the project has an active billing account.
-
Function Code: The function is deployed to us-central1 and the code specifies location: “us-central1” for Vertex AI and model: “gemini-1.0-pro”.
-
IAM Permissions: This is the key part. I have confirmed in the IAM console (with “Include Google-provided role grants” checked) that:
-
The Eventarc Service Agent (…gcp-sa-eventarc.iam.gserviceaccount.com) has the Eventarc Service Agent role.
-
The Vertex AI Service Agent (…gcp-sa-aiplatform.iam.gserviceaccount.com) exists and has the Vertex AI Service Agent and Vertex AI User roles.
-
I have followed all the official troubleshooting documentation for this 404 error, and everything seems to be configured correctly. The fact that the error persists makes me think there is a subtle, project-level provisioning issue that I can’t see.
Has anyone encountered a similar situation where a project seems unable to access standard Vertex AI models despite having the correct permissions? Is there another service agent or permission I might be missing?
Thank you so much for any help you can provide!