Supabase Edge Functions Timeout

266 views Asked by At

I have a NextJS 14 app running on an Amplify. The app is designed for text and images generation. To properly organize my code, I have created a Supabase Edge function who talks with OpenAI, retrieves the texts, handle the response (convert to JSON, etc), then insert the data in my Supabase DB. All works well. But sometimes I have to generate up to 50 uniques texts and images. When the time reaches 400 seconds (value given by Supabase themselves), Supabase stops the function execution, timeout !

I tried to send smaller requests to my Edge Function (50 requests instead of 1 request who generates 50 texts). Same result. I then decided to create multiple Edge functions (ie : the 10 firsts texts for the first Edge function, the 10 following for the second, etc.). Same result…

Idk what to do, it seems that no matter how I generate my texts/images, I’m identified by Supabase that gives me 400 seconds to generate all my contents.

Anyone else have experienced similar issues ?

Any advice would be welcome (maybe my approach and pattern are not optimized)

I hope to have been clear.

Regards.

0

There are 0 answers