Replies: 2 comments
|
Thanks for the detailed trace. Until something changes on the edge, two client-side changes shrink this a lot, and both use public APIs only. 1. Make the POSTs safe to retry, then retry once on this error. NSURLSession won't replay a POST because it can't know the request is idempotent, but most Supabase calls can be made idempotent:
With those in place, one retry inside a custom fetch ( 2. Keep the pooled connection from idling past the NAT timeout while the app is in the foreground. Any packet on the connection refreshes the NAT mapping. A cheap request every ~25 s while active (for example Neither replaces the edge-side fix you asked for, but together they turn "fails once, works on the next tap" into, at worst, a slower request. I'd be curious how often your retry fires. |
|
One addition to the custom-fetch suggestion: I would test the “server committed, response lost” case before enabling retries across all Supabase operations. Apple’s QA1941 explains why -1005 alone cannot tell you whether the server applied a request: For a write RPC, a useful staging test would be:
For deduplication, the request-ID check and database mutation need to be coordinated atomically. A separate “check whether ID exists, then perform operation” sequence can race. Scope the ID to the authenticated actor and operation, and reject reuse with a different payload. I would make write retries opt-in per operation rather than infer that every POST is replayable. Auth, storage uploads, and arbitrary Edge Functions have different semantics. A fetch wrapper also needs a replayable request body and should preserve cancellation. RFC 9110 describes the relevant retry boundary: This does not establish the cause of your HTTP/3 failure. It would strengthen the client workaround while the networking issue is investigated. Does your current retry testing include a committed write whose response is lost, or only requests that fail before reaching the handler? |
Uh oh!
There was an error while loading. Please reload this page.
supabase-ticket-excerpt.log
Client: a React Native app on supabase-js 2.117; on iOS its fetch is NSURLSession.
Summary
iOS reaches the Supabase API over HTTP/3. The QUIC connection stays pooled for 180 s of idle (the max_idle_timeout negotiated with the edge), and iOS sends no keepalives while a connection idles. When a NAT between the device and the edge forgets the UDP mapping before those 180 s (home routers in the 2-minute range, carrier NATs often sooner), the pooled connection is dead and neither end knows. The next request goes into it, nothing comes back, and NSURLSession fails it after about 6 s with -1005 "The network connection was lost". NSURLSession repeats a GET on a fresh connection by itself but never a POST (Apple QA1941), so sign-in (/auth/v1/token), RPCs and inserts (/rest/v1), storage calls (/storage/v1) and edge function invocations (/functions/v1) fail once and succeed on the next tap. This affects every iOS app on supabase-js, on any network whose NAT UDP timeout is shorter than 180 s.
What I measured (iOS 26.5 simulator, CFNetwork diagnostics, requests after controlled idle gaps; excerpt attached)
So the failure window runs from the NAT's UDP timeout up to 180 s.
Why I am asking you
There is no public API to disable HTTP/3 or to tune the QUIC keepalive or idle timeout in URLSession (Apple Developer Forums thread 771945; Apple tracks it as FB16097749, unchanged as of 2026). The poster of that thread had Cloudflare change the QUIC idle timeout for their own zone and the failures stopped. supabase.co is your zone, so only you can ask for it.
The ask: any one of these fixes it at the source
We have shipped a client-side retry (one more attempt on exactly this error) and can follow up with how often it fires across our users.
References
All reactions