edge function timeout for slow external API

As part of my core application functionality I have to call an external API that sometimes takes up to 10 minutes to respond and does not allow you to check in on it asynchronously. It also limits API calls per week (and I'll be using it heavily), so calling multiple times for each need isn't a great solution.

I've read through the responses to similar questions and have seen several suggestions. Being new to application development, I'm not sure which direction to go. Given that I'm developing an MVP, the solution with the shortest learning curve is probably preferable.

  1. Switch to Micro compute: I don't see any mention of a longer timeout on this page (https://supabase.com/docs/guides/platform/compute-and-disk), but someone mentioned in another thread that it enabled their edge functions to run longer.
  2. Use pgflow: it's not entirely clear to me how this (https://www.pgflow.dev/) works or what the learning curve is, but it's mentioned several times that longer-running jobs are a feature.
  3. Use websocket: I don't know what websocket is and some brief searching (https://supabase.com/docs/guides/functions/websockets) failed to clarify this for me. But it's mentioned in several other threads in the context of long-running API calls like mine.
  4. Use Cloudflare workers: This sounds like a common solution, but (like the other items) I'm not sure what the learning curve is. (https://supabase.com/partners/integrations/cloudflare-workers).
pgflow (Workflow Engine for Supabase)
Dead-simple workflow orchestration for Supabase. Build AI workflows you can actually debug with <100ms startup and full observability.
How to handle WebSocket connections in Edge Functions
Was this page helpful?