Edge function - get HTTP errors 520 / 546 #17258
-
Hi there, We have an application that makes an API call to one of our Supabase edge function. Some of the calls fail, and we're getting HTTP errors 520 and 546.
Does anyone know what these errors correspond to? Could it be related to Cloudflare, and if so, why? Thanks in advance for any help! |
Beta Was this translation helpful? Give feedback.
Replies: 16 comments 14 replies
-
We still experience this issue to this day. Is there anyone with experience to debug those cases? |
Beta Was this translation helpful? Give feedback.
-
@littleannie @Eldynn In your Supabase UI, would you please go to Edge Functions > {your edge function name} > Invocations and click on one of the errored calls, you should see a |
Beta Was this translation helpful? Give feedback.
-
@littleannie I'm from the Supabase Edge Functions team and want to provide an update on the HTTP errors. We are currently migrating Edge Functions to use Supabase Edge Runtime instead of Deno Deploy. This should require no change to existing functions deployed to Supabase and mostly transparent. You can check whether the function was served by Supabase Edge Runtime, if you check the response headers of a function call. It should have The 520 errors you experienced last week should be mostly fixed. This was due to a misconfiguration on our end during the roll out in certain regions. If you still see 520 responses, please open a support request so we can investigate. The 546 error status is returned when a resource limit of a function is reached. A resource limit can be CPU (50ms), memory (512mb) or wall clock time (ie. total time your function runs - 5mins). You should see the specific resource limit errors under the Logs section for specific edge function in Supabase dashboard. Please open a support request if your functions are continuously experiencing resource limit errors (546s), we can help you figure out what could be the underlying cause. |
Beta Was this translation helpful? Give feedback.
-
I'm also getting the 546 error while not violating any of these "A resource limit can be CPU (50ms), memory (512mb) or wall clock time (ie. total time your function runs - 5mins).". I am on eu-central1 |
Beta Was this translation helpful? Give feedback.
-
I am also getting the 546 error, the funny thing is the function works as it should, making api call etc. However the response its still 546 and no error log whatsover. |
Beta Was this translation helpful? Give feedback.
-
@laktek Also running into this. The edge function logs do not get any entries when there is a failure. The only place any indication of a failure is available is through a logs query where there's little useful information, such as
All I can tell is that edge function calls are failing with 502 or 546. There's no information about these failures in the edge function logs on the dashboard. For some of them I see a log from the function starting and that's all, it just silently ends after that. |
Beta Was this translation helpful? Give feedback.
-
As of 11/29 I'm facing this issue as well. It's very disappointing. |
Beta Was this translation helpful? Give feedback.
-
In case it is helpful: if there are any type errors in your function, it may run fine locally but bomb when you deploy it. Triple check your Typescript. |
Beta Was this translation helpful? Give feedback.
-
as for Dec 2, I get this error too, and have no idea what I can do to fix it. |
Beta Was this translation helpful? Give feedback.
-
Any solution for this? I got it too. |
Beta Was this translation helpful? Give feedback.
-
I have the same issue ^ |
Beta Was this translation helpful? Give feedback.
-
I am also facing the same issue. Even with a simple function returning only query parameters, the issue still exists. |
Beta Was this translation helpful? Give feedback.
-
I ended up ditching edge-functions for a simple Bun server running on fly.io. Too many random failures and pain with Deno on edge-functions. The process was pretty painless, basically these steps:
I've deployed this setup to production and so far it's vastly more stable and more performant. No more Deno pain either, I can import and use libraries and monorepo code normally and no more broken Deno language server. Hopefully the Supabase team will continue to make progress on edge functions and eventually they'll be more usable/stable (please no more Deno, it's an incredible pain) but this workaround was pretty easy and is working well so far. |
Beta Was this translation helpful? Give feedback.
-
After upgrading to the latest I started getting 546. My guess is it is related to supabase-edge-runtime upgrade.
I narrowed it down to
Once I add db.ts it begins to fail with the below error.
How can I opt out of supabase-edge-runtime-1.36.1 and go back to the original deno runtime or specific version like: edge-runtime:v1.33.5 ? |
Beta Was this translation helpful? Give feedback.
-
Is anyone still receiving this error? This is becoming more and more problematic for me and I can't seem to find a solution. I'm using "@supabase/supabase-js": "^2.22.0" and frequently see 520s and 546s, but my metrics are all under the limits. The CPU time limit seems to have changed now in the docs, but still, I'm averaging 400ms CPU time.. https://supabase.com/docs/guides/functions/debugging#limitations I wish the logs were better here. I just upgraded my supabase-js version to the latest and see if it's still happening. On top of this, I am getting a lot of memory limit exceeded errors in the logs which I think are a different issue? But there are no logs for this aside, Memory limit exceeded, and then shut down. |
Beta Was this translation helpful? Give feedback.
-
yeah having this issue also :'( |
Beta Was this translation helpful? Give feedback.
@littleannie I'm from the Supabase Edge Functions team and want to provide an update on the HTTP errors. We are currently migrating Edge Functions to use Supabase Edge Runtime instead of Deno Deploy. This should require no change to existing functions deployed to Supabase and mostly transparent.
You can check whether the function was served by Supabase Edge Runtime, if you check the response headers of a function call. It should have
x-served-by
set tosupabase-edge-runtime
. You should also see this in the edge function logs (in dashboard, Edge Functions > {Function Name> Logs) underserved_by
property. There's also a corresponding property (region) and a header (x-sb-edge-region), showin…