MUHAMMAD AHMAD SIDDIQUI

Full Stack & AI Engineer

000

Available for work·Book a call
All articles/When Supabase Hung on Real Devices: Diagnosing a QUIC/HTTP3 Stall in a React Native App
React NativeSupabaseNetworkingDebugging

When Supabase Hung on Real Devices: Diagnosing a QUIC/HTTP3 Stall in a React Native App

October 4, 20263 min read

While testing Chowzee, my food-delivery platform, on real devices, I hit one of those bugs that simulators never show you: on some phones, login hung, background token refresh stalled and food photos never loaded. Meanwhile the backend could reach the exact same hosts without any trouble.

The symptoms

  • Sign-in spun forever on certain devices and networks.
  • A session that had been fine would silently fail to refresh its token.
  • Images served from the photo CDN stayed blank.

All three have one thing in common: they are direct connections from the phone to Supabase and to the image CDN. Requests from my own FastAPI server to those same hosts worked fine, which pointed away from the services themselves and toward the path between the device and them.

Finding the cause

Reading real device logs showed connections to those hosts hanging while the client retried HTTP/3 (QUIC) and never fell back to HTTP/2 or HTTP/1.1. Some networks and devices handle QUIC badly: UDP gets throttled or dropped, and the client waits instead of falling back.

The giveaway was the asymmetry. The same hosts worked from the server (plain TCP) and failed from the phone (QUIC attempts). It was a transport problem, not an application problem.

The fix: narrow, transparent relays

Since I could not control the user's network, I moved those calls onto a path I do control: my own backend. I added three small relays to the FastAPI service:

  1. An auth relay that forwards Supabase Auth calls as a dumb pipe. It adds no extra privilege, and the client's own headers pass through unchanged.
  2. A storage relay for avatar images.
  3. An image relay locked to an allow-list of photo hosts.

The allow-list matters. A relay that fetches arbitrary URLs is an open SSRF proxy. Restricting the image relay to specific photo hosts means it can only ever do the one job it was built for.

On the mobile side, the Supabase client uses a custom fetch that reroutes those requests through the relays:

const relayFetch: typeof fetch = (input, init) => {
  const url = typeof input === "string" ? input : (input as Request).url;
  return fetch(rewriteToRelay(url), init);
};

const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY, {
  global: { fetch: relayFetch },
});

A nice side effect: automatic token refresh became reliable too, because it goes through the same working path.

Lessons

  • Test on real devices and networks early. Simulators use your laptop's connection and will hide this class of bug.
  • Compare the failing path with a working one. "The server can reach it, the phone cannot" cut the search space in half.
  • Keep relays minimal. Forward headers untouched, add no privileges, and allow-list anything that fetches a URL on a client's behalf.

The full project, including the four products and the architecture behind them, is in the Chowzee case study.