Persistent "Permission Denied" Error with Vertex AI, despite API & Billing being enabled

Hello everyone,

I’m developing an application and integrating AI features using Google’s Vertex AI (specifically the Gemini model). My setup involves a Node.js backend hosted on Render.

The backend deploys successfully, but when it tries to make a call to the Vertex AI API, it consistently fails with a 403 PERMISSION_DENIED error.

My Question:

What could still be causing a PERMISSION_DENIED error when the API, billing, and IAM role all seem to be correctly configured? Are there any less obvious project-level settings, API dependencies, or permissions I might be missing?

Any help would be greatly appreciated. Thank you!..Here is the core of my problem:

I’m trying to use the Vertex AI API to generate content.

I have already enabled the Vertex AI API in my Google Cloud project.

I have an active Billing Account linked to the project.

I’ve created a Service Account, granted it the “Vertex AI User” role, and I am using its JSON key for authentication on Render.

Despite all of this, I keep getting a “Permission denied on resource project…” error.

ALso I have tried using openai api, it is also not working

I have tried gemini api, same issue

only Groq is working and i don’t want to work with it, my app needs translationa nd groq is not good for it also , i need to send long text and Groq doesn’t support it

Hi @khansa4700,

Welcome to Google Cloud Community!

Here are some suggestions that may help resolve the issue:

  • Possibly, the issue may be caused by how credentials are handled on Render during authentication. Consider the Application Default Credentials (ADC) strategy when authenticating if applicable, set the GOOGLE_APPLICATION_CREDENTIALS environment variable to the correct file path of your service account’s JSON key. Ensure that the path is accurate and accessible within the Render environment.
  • Double-check for typographical errors, such as an incorrect project ID or a location mismatch when calling the API, as these can sometimes cause permission errors.
  • If your API request has dependencies on other Google Cloud resources, ensure that the Vertex AI per-product, per-project service account (P4SA) has necessary permission.

In addition, you might find it helpful to check this Stack Overflow discussion.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.

1 Like