Hello everyone,
I've developed a text adventure game using AI Studio and deployed it at: <URL Removed by Staff>
I'm encountering a critical issue that seems to be platform-specific.
Problem Description: The game runs perfectly on desktop browsers (e.g., Chrome on Mac/PC). However, when I open the game on an iPhone (either Safari or Chrome), it fails to initialize and returns a 502 Bad Gateway error. Error Message: Here is the exact error returned on the iPhone:
Error: Failed to initialize game with Gemini: got status: 502 . {"error":"Proxying failed","details":"ReadableStream uploading is not supported","name":"NotSupportedError","proxiedUrl":"https://game.innotechlab.org/api-proxy/v1beta/models/gemini-2.5-flash-preview-04-17:generateContent"}
My Analysis: My hypothesis is that this issue is related to the server-side architecture, possibly within Google Cloud Run.
The error detail ReadableStream uploading is not supported strongly suggests that there's a proxy layer handling the Gemini API calls.
This proxy appears to be incompatible with the ReadableStream requests that are likely being sent by the mobile browser, while the desktop browser might be using a different request method.
Steps to Reproduce:
1. Open <URL Removed by Staff> on a desktop browser (works).
2. Open the same URL on an iPhone browser (fails with the 502 error).
Could anyone offer some insight into this? Is there a known limitation with the proxy used in this environment, or is there a way to configure it to support streamable requests? Thank you for your time and help!
================ updated 06/13/2025 ==================
Hello everyone,
// ... inside the 'fetch' event listener ...
const requestOptions = {
method: event.request.method,
body: event.request.body, // The original ReadableStream body
// ... other options
};
// This is the smoking gun!
if (event.request.method !== 'GET' && event.request.method !== 'HEAD' && event.request.body ) {
requestOptions.duplex = 'half';
}
const promise = fetch(new Request(proxyUrl, requestOptions));
Hi @Bob_Freeman,
Welcome to Google Cloud Community!
A 502
Bad Gateway error on your iPhone, while using your Cloud Run-hosted app, means something went wrong when Cloud Run tried to connect to your game's server. This could be because the game's taking too long to respond, there's a connection problem, or something's not set up correctly in Cloud Run. Here’s relevant documentation that may help you:
If you're using Google Cloud Load Balancing in front of your Cloud Run service, you'll need to check its documentation:
Note : Ensure HTTP functions send an HTTP response. Failing to do so can result in your function executing until timeout.
If the issue still persists and needs further assistance, please feel free to reach out to our Google Cloud Support team to investigate the internal error furthermore.
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.
I’m having the exact same error code and this discussion is the only place I’ve seen it mentioned so far so his must be a fairly new bug. I seldom even google search error codes these days so it must be serious!
For me, AI studio is forcing me to use this proxy and I have no way to change or manage the http settings when deploying an app from AI Studio. This needs fixing by the team I believe.
I cannot make any Gemini requests on any browser or device that isn’t running chrome desktop without getting this same error.
i have the exact same issue. works on android and desktop but not on iOS. iOS Safari and iOS Chrome both fail.
I have the exact same problem and error. I generated an AI Bot via AI Studio. It works flawlessly on a desktop, it fails with this error on iOS.
Sorry, I encountered an error. This might be due to network connectivity, a proxy configuration issue, or a problem with the AI service. Please try again. (Details: got status: 502 . {"error":"Proxying failed","details":"ReadableStream uploading is not supported","name":"NotSupportedError","proxiedUrl":"https://gemini-urbanization-chatbot-59038517359.us-west1.run.app/api-proxy/v1beta/models/gemini-2.5-..."})
I tested both on desktop (Windows) and Android and seems that on both the published AI agent works fine. The problem is connected somehow to iOS or how iOS handles webpages.
Me too! Exactly the same! Tried a bunch of different things to fix! Always get back to the same issue...
Can you give us a timeline for getting this fix as it seems to be a Google issue. It's crippling my work!!
Hit exactly the same issue on IOS.
I have the same issue on android mobile and iOS….
on iOS, it has worked intermittently
Error: Failed to generate names: got status: 502 . {"error":"Proxying failed","details":"ReadableStream uploading is not supported","name":"NotSupportedError","proxiedUrl":"https://similar-name-and-generator-7359801759.us-west1.run.app/api-proxy/v1beta/models/gemini-2.5-fl..."}.
I'm experiencing a similar issue:
1. Develop app on AI Studio that calls gemini-2-flash-preview
2. Works in AI Studio with either the free tier or with my key
3. Deploy to Cloud Run
4. Hit from IOS browser
Results in:
Status 502
{"error":"Proxying failed","details":"ReadableStream uploading is not supported","name":"NotSupportedError","proxiedUrl":"https://[REMOVED]/api-proxy/v1beta/models/gemini-2.5-flash-preview-04-17:generateContent"}
On my cloud run project I see 100% error rate on Vertex AI API calls and 86% error rate on Gemini for Google Cloud API. I can offer more details if anyone from Google is interested.
SImilar problem deploying from aistudio, works perfect on chrome / android but fails on Ios
I'm also facing the same issue on Safari:
Sorry, I encountered an error: Gemini API Error: got status: 502 . {"error":"Proxying failed","details":"ReadableStream uploading is not supported","name":"NotSupportedError","proxiedUrl":"https://my-app.us-west1.run.app/api-proxy/v1beta/models/gemini-2.5-flash-preview-04-17:generateContent"}. Please try again.
Same issue, anyone have luck resolving it? It's very annoying ...
Having the same issues on ios mobile
Have you been able to Fix the issue Bob? How do you go about it step by step?