mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 09:25:06 +03:00
Some updates to Edge Functions guides (#26877)
* chore: link to Sentry guide from Debugging section * chore: Change Edge Function Quickstart to Get started This section isn't much of a quickstart. Updated the first guide title to "Create an Edge Function" * chore: moved Edge Functions limits to a separate page * chore: added a page on HTTP Status codes Edge Functions can return
This commit is contained in:
1 parent
322e46aed4
commit
a133a111d2
5 files changed
+94
-15
No files matched your search
@@ -1081,11 +1081,11 @@ export const functions: NavMenuConstant = {
|
||||
url: '/guides/functions',
|
||||
},
|
||||
{
|
||||
name: 'Quickstart',
|
||||
name: 'Getting started',
|
||||
url: undefined,
|
||||
items: [
|
||||
{
|
||||
name: 'Getting started',
|
||||
name: 'Create an Edge Function',
|
||||
url: '/guides/functions/quickstart',
|
||||
},
|
||||
{
|
||||
@@ -1153,6 +1153,24 @@ export const functions: NavMenuConstant = {
|
||||
name: 'Testing your Edge Functions',
|
||||
url: '/guides/functions/unit-test',
|
||||
},
|
||||
{
|
||||
name: 'Monitoring with Sentry',
|
||||
url: '/guides/functions/examples/sentry-monitoring',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Platform',
|
||||
url: undefined,
|
||||
items: [
|
||||
{
|
||||
name: 'Status codes',
|
||||
url: '/guides/functions/status-codes',
|
||||
},
|
||||
{
|
||||
name: 'Limits',
|
||||
url: '/guides/functions/limits',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -141,10 +141,7 @@ To find the bundle size of a function, run the following command locally:
|
||||
|
||||
Look for the "size" field in the output which represents the approximate bundle size of the function. You can find the accurate bundle size when you deploy your function via Supabase CLI. If the function is part of a larger application, consider examining the bundle size of the specific function independently.
|
||||
|
||||
The source code of a function is subject to size limits:
|
||||
|
||||
- **Free Plan**: Maximum size of 2MB.
|
||||
- **Pro Plan**: Maximum size of 10MB.
|
||||
The source code of a function is subject to 10MB site limit.
|
||||
|
||||
### Analyze dependencies
|
||||
|
||||
@@ -171,12 +168,3 @@ For example, if you only need the `Sheets` submodule from the `googleapis` packa
|
||||
```typescript
|
||||
import { Sheets } from 'npm:@googleapis/sheets'
|
||||
```
|
||||
|
||||
## Limitations
|
||||
|
||||
- Outgoing connections to ports `25` and `587` are not allowed.
|
||||
- Serving of HTML content is not supported (`GET` requests that return `text/html` will be rewritten to `text/plain`).
|
||||
- Deno and Node file system APIs are not available.
|
||||
- Memory limit for the function: 256MB
|
||||
- Wall clock limit: 400 s
|
||||
- CPU Time: 2 s
|
||||
@@ -0,0 +1,23 @@
|
||||
---
|
||||
id: 'functions-limits'
|
||||
title: 'Limits'
|
||||
description: "Limits applied Edge Functions in Supabase's hosted platform."
|
||||
subtitle: "Limits applied Edge Functions in Supabase's hosted platform."
|
||||
---
|
||||
|
||||
## Runtime limits
|
||||
|
||||
- Maximum Memory: 256MB
|
||||
- Maximum Duration (Wall clock limit): 400s (this is the duration an Edge Function worker will stay active. During this period, a worker can serve multiple requests)
|
||||
- Maximum CPU Time: 2s
|
||||
- Request idle timeout: 150s (if an Edge Function doesn't send a response before the timeout, 504 Gateway Timeout will be returned)
|
||||
- Maximum Function Size (after bundling via CLI): 10MB
|
||||
- Maximum log message length: 10,000 characters
|
||||
- Log event threshold: 100 events per 10 seconds
|
||||
|
||||
## Other limits & restrictions
|
||||
|
||||
- Outgoing connections to ports `25` and `587` are not allowed.
|
||||
- Serving of HTML content is not supported (`GET` requests that return `text/html` will be rewritten to `text/plain`).
|
||||
- Deno and Node file system APIs are not available.
|
||||
- Web Worker API (or Node `vm` API) are not available.
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
id: 'functions-status-codes'
|
||||
title: 'Status codes'
|
||||
description: 'Edge Functions can return following status codes.'
|
||||
subtitle: 'Edge Functions can return following status codes.'
|
||||
---
|
||||
|
||||
## 2XX Success
|
||||
|
||||
A successful Edge Function Response
|
||||
|
||||
## 3XX Redirect
|
||||
|
||||
The Edge Function has responded with a `Response.redirect` (API docs)[https://developer.mozilla.org/en-US/docs/Web/API/Response/redirect_static]
|
||||
|
||||
## 4XX Client Errors
|
||||
|
||||
### 401 Unauthorized
|
||||
|
||||
If the Function has `Verify JWT` option enabled, but the request was made with an invalid JWT.
|
||||
|
||||
### 404 Not Found
|
||||
|
||||
Requested function was not found.
|
||||
|
||||
### 405 Method Not Allowed
|
||||
|
||||
Edge Functions only support these HTTP methods 'POST', 'GET', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'
|
||||
|
||||
## 5XX Server Errors
|
||||
|
||||
### 500 Internal Server Error
|
||||
|
||||
When an Edge Function throws an uncaught exception (`WORKER_ERROR`). Check Edge Function logs to find the cause.
|
||||
|
||||
### 503 Service Unavailable
|
||||
|
||||
Function failed to start (`BOOT_ERROR`). Check Edge Function logs to find the cause.
|
||||
|
||||
### 504 Gateway Timeout
|
||||
|
||||
Function doesn't respond before the [request idle timeout](/guides/functions/limits).
|
||||
|
||||
### 546 Resource Limit (Custom Error Code)
|
||||
|
||||
Function execution was stopped due to a resource limit (`WORKER_LIMIT`). Edge Function logs should provide which [resource limit](/guides/functions/limits) was exceeded.
|
||||
@@ -39,3 +39,7 @@ Free-plan projects may be paused due to inactivity, on request by the owner, or
|
||||
The request is not completed within the configured time limit.
|
||||
|
||||
The timeout limit is set to prevent long-running queries which can cause performance issues, increase latency, and potentially even crash the project.
|
||||
|
||||
#### 546 Edge Functions Resource Limit
|
||||
|
||||
Applies only to Edge Functions. Function execution was stopped due to a resource limit (`WORKER_LIMIT`). Edge Function logs should provide which [resource limit](/guides/functions/limits) was exceeded.
|
||||
Reference in new issue
Block a user