You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Otherwise, run the below query in your Log Explorer.
selectreq.pathnameas function_name,
res.status_code,
case
when metadata.execution_idis not nullandmetadata.function_idis not null then 'app_level'
when metadata.execution_id is nullandmetadata.function_idis not null then 'boot_error'
when metadata.execution_id is nullandmetadata.function_id is null then 'internal_failure'
end as error_type
from
function_edge_logs
cross join UNNEST(metadata) as metadata
cross join UNNEST(metadata.request) as req
cross join UNNEST(metadata.response) as res
where status_code =503limit50;
Depending on the output, you can use this table to find the appropriate debugging section:
A SyntaxError prevented your code from dynamically compiling.
In the Function Dashboard, under the affected function's Log tab, you can filter for the key phrase worker boot error:. the log will tell you syntax error occurred:
Alternatively, instead of using the Function Dashboard, you can programmatically find boot failure error messages in the Log Explorer with the below query:
selectfl.event_message,
content.timestamp,
fel.function_name,
fel.status_codefrom
function_logs as fl
left join UNNEST(fl.metadata) as content on true
left join (
selectem.function_id,
em.version,
req.pathnameas function_name,
res.status_codefrom
function_edge_logs
left join UNNEST(metadata) as em on true
left join UNNEST(em.request) as req on true
left join UNNEST(em.response) as res on true
) as fel
oncontent.function_id=fel.function_idandcontent.version=fel.versionwherecontent.event_type='BootFailure'order bytimestamp, function_name
limit20;
Example causes
Redefining constant variables
Redefining a constant value can prevent the code from compiling:
The log message for these errors should state the cause already declared and the file impacted.
worker boot error: Uncaught SyntaxError:
Identifier 'some_var' has already been declared at file:///var/tmp/sb-compile-edge-runtime/source/index.ts:6:7
Key word violations
Some key words can only be used in specific contexts. For instance, the await key word can only be used inside async functions.
(req: Request)=>{const{ name }=awaitreq.json();// await only works inside async functions}
The log message for these errors should state the cause Unexpected reserved word and the file impacted.
worker boot error: Uncaught SyntaxError:
Unexpected reserved word at file:///var/tmp/sb-compile-edge-runtime/source/index.ts:6:28
Bad imports: Non-existent modules or named exports
Imports can cause errors if they're not available within the edge function:
// importing non-existent moduleimportsupabasefrom'does_not_exist'// or accessing non-existent exportimport{doesNotExist}from'jsr:@supabase/functions-js'doesNotExist()
The log message for these errors should state the cause requested module... does not provide an export and the file impacted.
worker boot error: Uncaught SyntaxError:
The requested module 'jsr:@supabase/functions-js' does not provide an export named 'doesNotExist' at file:///var/tmp/sb-compile-edge-runtime/source/index.ts:2:10”
To fix, check the module and its imports to make sure they exist and are supported by Supabase Edge Functions.
If the module worked before, check to see if the most recent release had breaking changes and then only import the working version.
Platform issue
The edge function runtime is overwhelmed, or the API Gateway is returning its own 503 due to excessive load.
Open a support ticket and include the relevant log output from Step 1.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
This is a copy of a troubleshooting article on Supabase's docs site. It may be missing some details from the original. View the original article.
A 503 HTTP status code from an Edge Function indicates one of three possible events:
SyntaxErrorThese require different fixes, so it is useful to decipher the cause before debugging:
Step 1: Figure out which 503 you have
If you received back a
BOOT_ERRORmessage, like the one below, you can jump to the resolution section: Boot Error{ "code": "BOOT_ERROR", "message": "Function failed to start (please check logs)" }Otherwise, run the below query in your Log Explorer.
Depending on the output, you can use this table to find the appropriate debugging section:
app_levelboot_errorinternal_failureStep 2: Addressing the error
App level error
Somewhere in your function logic, you are returning a 503 response yourself:
Example:
Check your function logic and any third-party API responses for where the 503 is originating.
503. Look for explicit status codes onResponseobjectsSee: Error handling in Edge Functions
Boot error
A
SyntaxErrorprevented your code from dynamically compiling.In the Function Dashboard, under the affected function's
Logtab, you can filter for the key phraseworker boot error:. the log will tell you syntax error occurred:Alternatively, instead of using the Function Dashboard, you can programmatically find boot failure error messages in the Log Explorer with the below query:
Example causes
Redefining constant variables
Redefining a constant value can prevent the code from compiling:
The log message for these errors should state the cause
already declaredand the file impacted.worker boot error: Uncaught SyntaxError: Identifier 'some_var' has already been declared at file:///var/tmp/sb-compile-edge-runtime/source/index.ts:6:7Key word violations
Some key words can only be used in specific contexts. For instance, the
awaitkey word can only be used insideasyncfunctions.The log message for these errors should state the cause
Unexpected reserved wordand the file impacted.Bad imports: Non-existent modules or named exports
Imports can cause errors if they're not available within the edge function:
The log message for these errors should state the cause
requested module... does not provide an exportand the file impacted.To fix, check the module and its imports to make sure they exist and are supported by Supabase Edge Functions.
If the module worked before, check to see if the most recent release had breaking changes and then only import the working version.
Platform issue
The edge function runtime is overwhelmed, or the API Gateway is returning its own 503 due to excessive load.
Open a support ticket and include the relevant log output from Step 1.
Additional resources
Still stuck?
Beta Was this translation helpful? Give feedback.
All reactions