Hello community,
I'm trying to make a basic API call to Vertex AI to use the `gemini-1.0-pro` model from a Vercel serverless function, but I'm consistently getting a 404 error indicating the model is not found or my project does not have access.
The strange part is that this issue persists even on a brand new, clean Google Cloud project, which leads me to believe this is not a simple configuration error. I'm hoping someone in the community might have some insight.
**The Error:**
The exact error message returned by the API is:
```json
{
"error": {
"code": 404,
"message": "Publisher Model 'projects/[PROJECT_ID]/locations/us-central1/publishers/google/models/gemini-1.0-pro' was not found or your project does not have access to it. Please ensure you are using a valid model version.",
"status": "NOT_FOUND"
}
}
content_copydownload
Use code with caution.
What I’ve Exhaustively Tried (Diagnostics):
To isolate the issue, I’ve run a full A/B test on two separate projects:
-
Project A (Original - [PII Removed by Staff]):
-
Configured with a Service Account, JSON key, Vertex AI User role, enabled Vertex AI API, and linked to an active billing account.
-
Result: Consistent 404 error.
-
-
Project B (New/Sterile - syro-fresh-start):
-
Created this project from scratch to rule out any misconfiguration.
-
Created a brand new Service Account (syro-vercel-agent) with the Vertex AI User role.
-
Enabled the Vertex AI API, IAM Credentials API, and Cloud Resource Manager API.
-
Linked it to the same active billing account.
-
Used a new, freshly generated JSON key for the Service Account.
-
Result: The exact same 404 error.
-
My Code:
The Node.js code is standard and uses google-auth-library. Here is the relevant logic:
Generated javascript
const { GoogleAuth } = require('google-auth-library');
// Authentication
const auth = new GoogleAuth({
credentials: JSON.parse(process.env.GOOGLE_APPLICATION_CREDENTIALS_JSON),
scopes: 'https://www.googleapis.com/auth/cloud-platform',
});
const client = await auth.getClient();
const accessToken = (await client.getAccessToken()).token;
// API Call
const project = 'syro-fresh-start';
const location = 'us-central1';
const model = 'gemini-1.0-pro';
const url = `https://${location}-aiplatform.googleapis.com/v1/projects/${project}/locations/${location}/publishers/google/models/${model}:predict`;
const response = await fetch(url, {
method: 'POST',
headers: {
'Authorization': `Bearer ${accessToken}`,
'Content-Type': 'application/json',
},
// ... body
});
content_copydownload
Use code with caution.JavaScript
My Conclusion & Question:
Since the error is identical across two independent and correctly configured projects, I believe the issue is not at the project level. It seems to point to a potential restriction or provisioning issue at the Google Cloud account level.
My questions for the community are:
-
Has anyone encountered a similar persistent 404 error with Vertex AI on a brand new Google Cloud account/projects?
-
Is there a known, undocumented activation step or waiting period for Vertex AI access on new accounts that I might be missing?
-
Are there any other diagnostic steps you could suggest?
Thank you for any help or insights you can provide.