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
Copy file name to clipboardExpand all lines: docs/integrations/supabase.md
+62Lines changed: 62 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -185,6 +185,10 @@ Edge Functions are ideal for:
185
185
You can find [**more examples**](https://supabase.com/docs/guides/functions#examples) in the official documentation.
186
186
:::
187
187
188
+
:::warning
189
+
Dreamflow doesn’t support running Edge Functions locally yet because the editor has no built-in terminal or local [**Deno**](https://deno.com/) runtime.
190
+
:::
191
+
188
192
### Create and Deploy
189
193
190
194
Dreamflow provides a built-in workflow to generate, edit, configure, and deploy Supabase Edge Functions directly from your project — no command line needed.
- **Use Shared Modules for Reusable Logic:** If multiple functions need the same utilities (like an OpenAI client, validators, or formatting helpers), place them inside `supabase/functions/_shared/`. This avoids code duplication and keeps each function focused only on its own task.
400
404
- **Use `database.types.ts` for Strong Typing:** Generate and import `database.types.ts` to ensure all database queries inside edge functions match your actual schema. This provides autocomplete, prevents schema mismatches, and makes your functions safer and easier to maintain.
405
+
- **Use Consistent Error Handling Patterns:** Implement clear and predictable error handling inside each Edge Function. Wrap risky operations in `try/catch`, log errors using `console.error()` so they appear in the Supabase Dashboard logs, and always return structured JSON error responses.
401
406
402
407
## FAQs
403
408
@@ -493,4 +498,61 @@ It depends on whether the function **requires JWT verification**. If the “Veri
How do I access the logged-in user inside an Edge Function?
506
+
</summary>
507
+
508
+
<p>
509
+
When your app makes a request and the user is logged in, the user’s JWT is automatically included in the `Authorization` header. Inside your Edge Function, you can read this header and fetch the authenticated user like this:
The `user` will contain the full Supabase Auth user object. If the request has no token or an invalid token, `user` will be `null`.
517
+
</p>
518
+
</details>
519
+
520
+
<details>
521
+
<summary>
522
+
Why am I getting “Error: Function invocation timed out” and how do I fix it?
523
+
</summary>
524
+
525
+
<p>
526
+
527
+
This error appears when your Edge Function takes too long to finish, often because it’s waiting on a slow external API call without a timeout. For example, a request like `awaitfetch("https://slow-api.example.com/report")` can hang indefinitely, causing the function to hit Supabase’s execution limit and fail.
528
+
529
+
To fix this, add a timeout using `AbortController`:
0 commit comments