I recently made a copy of a project to work on a series of updates, whilst preserving the original. I have deployed the new version to Cloud Run, with its API secret, and yet the new copy always returns this message when generating an image.
Failed to generate image. {“error”:“Forbidden”}
The original project (also hosted with Google Cloud Run within the same cloud project) runs fine and works as needed.
I have checked my APIs for any restrictions, I am on a paid billing account also.
The original live project works fine. However I made a copy to update in order to preserve the original due to the ongoing issues with AI Studio.
I tested the appliction inside AI Studio and it worked really well. However now it is live, it always returns this message.
In DEV Mode within Chrome - I get the following message with the error.
POST https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image:generateContent 403 (Forbidden)
| apiCall | @ | index-BPcFo9ol.js:129 | |
|---|---|---|---|
| unaryApiCall | @ | index-BPcFo9ol.js:125 | |
| request | @ | index-BPcFo9ol.js:125 |
| await in request | |||
|---|---|---|---|
| generateContentInternal | @ | index-BPcFo9ol.js:149 | |
| JC.generateContent | @ | index-BPcFo9ol.js:149 |
| await in JC.generateContent | |||
|---|---|---|---|
| zN | @ | index-BPcFo9ol.js:399 |
| await in zN | |||
|---|---|---|---|
| Ii | @ | index-BPcFo9ol.js:668 | |
| xe | @ | index-BPcFo9ol.js:668 | |
| onClick | @ | index-BPcFo9ol.js:668 | |
| Mp | @ | index-BPcFo9ol.js:48 | |
| (anonymous) | @ | index-BPcFo9ol.js:48 | |
| kc | @ | index-BPcFo9ol.js:48 | |
| su | @ | index-BPcFo9ol.js:48 | |
| Su | @ | index-BPcFo9ol.js:49 | |
| wv | @ | index-BPcFo9ol.js:49 |
Error transforming image: ApiError: {“error”:“Forbidden”}
at tg (index-BPcFo9ol.js:129:4200)
at async index-BPcFo9ol.js:125:5849
at async JC.generateContent (index-BPcFo9ol.js:149:807)
at async zN (index-BPcFo9ol.js:399:113)
at async Ii (index-BPcFo9ol.js:668:68274)
| zN | @ | index-BPcFo9ol.js:399 |
|---|
| await in zN | |||
|---|---|---|---|
| Ii | @ | index-BPcFo9ol.js:668 | |
| xe | @ | index-BPcFo9ol.js:668 | |
| onClick | @ | index-BPcFo9ol.js:668 | |
| Mp | @ | index-BPcFo9ol.js:48 | |
| (anonymous) | @ | index-BPcFo9ol.js:48 | |
| kc | @ | index-BPcFo9ol.js:48 | |
| su | @ | index-BPcFo9ol.js:48 | |
| Su | @ | index-BPcFo9ol.js:49 | |
| wv | @ | index-BPcFo9ol.js:49 |
Any help?