cli icon indicating copy to clipboard operation
cli copied to clipboard

Api gateway idle request timeout is set to 60s in local stack

Open gabe-engineers opened this issue 2 years ago • 4 comments

Describe the bug Hello!

I have an edge function which calls a LLM API as dependency, and this LLM API can take a while to respond, about 60s+

I'm consistently getting a 504 Gateway timeout at the 60s mark, which I believe is from the Kong API Gateway that has a 60s timeout by default.

In the production supabase hosted functions, the idle timeout is 150s according to the docs. I've tested my API with the deployed edge function and my API call succeeds as gateway allows for the request to go beyond the 60s mark.

My thought is the timeout of the local stack kong being 60s must be an oversight, since the prod versions support more. Are we able to increase the kong timeout to 150s to match the prod version? I'm free to help if needed.

Also, I'm somewhat new to supabase so let me know if I'm misunderstanding anything.

To Reproduce Steps to reproduce the behavior:

  1. supabase start
  2. serve an edge function locally and in the code add a sleep function like setTimeout to wait for 70s
  3. call the function with a http client like curl or insomnia
  4. See the 504 error show up at the 60s mark

Expected behavior The kong api gateway should allow idle requests to go up to 150s

Screenshots Screenshot_20240614_205752

System information Rerun the failing command with --create-ticket flag.

  • Ticket ID: (Didn't get a ticket ID from the flag)
  • Version of OS: Manjaro x86_64 kernel: 6.9.3-3-MANJARO
  • Version of CLI: 1.176.10
  • Version of Docker: 26.1.3
  • Versions of services: supabase/postgres │ 15.1.1.56 supabase/gotrue │ v2.152.0
    postgrest/postgrest │ v12.1
    supabase/realtime │ v2.28.32 supabase/storage-api │ v1.2.1 supabase/edge-runtime │ v1.54.2
    supabase/studio │ 20240422-5cf8f30 supabase/postgres-meta │ v0.80.0
    supabase/logflare │ 1.4.0
    supabase/supavisor │ 1.1.56
    darthsim/imgproxy │ v3.8.0

gabe-engineers avatar Jun 15 '24 01:06 gabe-engineers

Following, have same problem

Zoz24 avatar Jun 15 '24 02:06 Zoz24

I've increased the timeout to 150s in cli beta release.

npx supabase@beta start

sweatybridge avatar Jun 27 '24 13:06 sweatybridge

I've increased the timeout to 150s in cli beta release.

npx supabase@beta start

@sweatybridge I believe the same problem also exists for memory limit. When I locally run a function that contains a sizable image my function being terminated for exceeding memory. However when the edge function is deployed there isn't any memory issue so the underlying cause is probably the same. Is there an existing issue for this bug as well?

Zoz24 avatar Jul 07 '24 02:07 Zoz24

I believe the same problem also exists for memory limit.

You are right. I will address this in another release https://github.com/supabase/cli/issues/2500

Thank you for spotting these inconsistencies.

sweatybridge avatar Jul 07 '24 05:07 sweatybridge