Skip to main content

Fixing CancelledError When FastAPI SSE Clients Disconnect

Β· 2 min read

Encountered this while building an AI customer-service automation system for a client β€” recording the root cause and fix.

TL;DR​

FastAPI's StreamingResponse cancels the generator task when the client disconnects, raising asyncio.CancelledError. The correct fix is to catch the exception inside the generator and re-raise β€” otherwise you get error-log noise and resource leaks.

Three Pitfalls Integrating Supabase Auth with FastAPI

Β· 4 min read

Encountered this while building a SaaS authentication system for a client β€” recording the root causes and fixes.

TL;DR​

Supabase Auth + FastAPI integration has three common pitfalls: the JWKS path is not the standard one, ES256 signatures need conversion to DER format, and first-time users have no local database record. Complete solutions below.