mirror of
https://github.com/supabase/supabase.git
synced 2026-10-10 20:05:06 +03:00
running prettier againt doc
This commit is contained in:
1 parent
7763b209bb
commit
28694d2897
1 file changed
+21
-22
@@ -47,38 +47,37 @@ Go to: [Your function returned a 404](#your-function-returned-a-404)
|
||||
|
||||
### Identifying 404s from the Function logs
|
||||
|
||||
Run the below query in the [Log Explorer](/dashboard/project/_/logs/explorer?q=SELECT%0A++req.pathname+AS+function_name,%0A++CASE%0A++++WHEN+metadata.execution_id+IS+NULL+THEN+%27unrecognized_function%27%0A++++ELSE+%27app_level_error%27%0A++END+AS+cause,%0A++timestamp%0AFROM%0A++function_edge_logs%0A++CROSS+JOIN+UNNEST(metadata)+AS+metadata%0A++CROSS+JOIN+UNNEST(metadata.request)+AS+req%0A++CROSS+JOIN+UNNEST(metadata.response)+AS+res%0AWHERE%0A++res.status_code+=+404%0ALIMIT+10;&its=&ite=):
|
||||
Run the below query in the [Log Explorer](</dashboard/project/_/logs/explorer?q=SELECT%0A++req.pathname+AS+function_name,%0A++CASE%0A++++WHEN+metadata.execution_id+IS+NULL+THEN+%27unrecognized_function%27%0A++++ELSE+%27app_level_error%27%0A++END+AS+cause,%0A++timestamp%0AFROM%0A++function_edge_logs%0A++CROSS+JOIN+UNNEST(metadata)+AS+metadata%0A++CROSS+JOIN+UNNEST(metadata.request)+AS+req%0A++CROSS+JOIN+UNNEST(metadata.response)+AS+res%0AWHERE%0A++res.status_code+=+404%0ALIMIT+10;&its=&ite=>):
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
req.pathname AS function_name,
|
||||
CASE
|
||||
WHEN metadata.execution_id IS NULL THEN 'unrecognized_function'
|
||||
ELSE 'app_level_error'
|
||||
END AS cause,
|
||||
select
|
||||
req.pathname as function_name,
|
||||
case
|
||||
when metadata.execution_id is null then 'unrecognized_function'
|
||||
else 'app_level_error'
|
||||
end as cause,
|
||||
timestamp
|
||||
FROM
|
||||
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
|
||||
res.status_code = 404
|
||||
LIMIT 10;
|
||||
cross join UNNEST(metadata) as metadata
|
||||
cross join UNNEST(metadata.request) as req
|
||||
cross join UNNEST(metadata.response) as res
|
||||
where res.status_code = 404
|
||||
limit 10;
|
||||
```
|
||||
|
||||
The `function_name` column tells you exactly what path was requested, while `cause` indicates whether the platform rejected it or your code returned the 404.
|
||||
|
||||
Depending on the output, you can use this table to find the appropriate debugging section:
|
||||
|
||||
| Cause | Go to |
|
||||
|---|---|
|
||||
| `app_level_error` | [Your function returned a 404](#your-function-returned-a-404) |
|
||||
| `unrecognized_function` | [Unrecognized function](#unrecognized-function) |
|
||||
| Cause | Go to |
|
||||
| ----------------------- | ------------------------------------------------------------- |
|
||||
| `app_level_error` | [Your function returned a 404](#your-function-returned-a-404) |
|
||||
| `unrecognized_function` | [Unrecognized function](#unrecognized-function) |
|
||||
|
||||
---
|
||||
|
||||
# Actioning the error
|
||||
# Addressing the error
|
||||
|
||||
## Your function returned a 404
|
||||
|
||||
@@ -90,7 +89,7 @@ Your function executed successfully at the platform level, but your code returne
|
||||
return new Response(JSON.stringify({ error: 'Not found' }), {
|
||||
headers: { ...corsHeaders, 'Content-Type': 'application/json' },
|
||||
status: 404, // <-- you set this
|
||||
});
|
||||
})
|
||||
```
|
||||
|
||||
**How to fix:**
|
||||
@@ -100,7 +99,7 @@ return new Response(JSON.stringify({ error: 'Not found' }), {
|
||||
3. Add logging before the return so future occurrences leave a trace:
|
||||
|
||||
```js
|
||||
console.error('Returning 404 - reason:', reason);
|
||||
console.error('Returning 404 - reason:', reason)
|
||||
```
|
||||
|
||||
See: [Error handling in Edge Functions](/docs/guides/functions/error-handling)
|
||||
@@ -159,4 +158,4 @@ If redeploying corrects your issue or if it continues to persist, open a ticket
|
||||
- [Securing Edge Functions](/docs/guides/functions/auth)
|
||||
- [Debugging Edge Functions](/docs/guides/functions/logging)
|
||||
- [Quickstart: Dashboard deployment](/docs/guides/functions/quickstart-dashboard)
|
||||
- [Quickstart: CLI deployment](/docs/guides/functions/quickstart)
|
||||
- [Quickstart: CLI deployment](/docs/guides/functions/quickstart)
|
||||
Reference in new issue
Block a user