From b0100265e13223a0617fa72e3fcc4eb111723329 Mon Sep 17 00:00:00 2001 From: Lakshan Perera Date: Tue, 4 Feb 2025 09:24:03 +1100 Subject: [PATCH] chore: add more rules to Edge Functions AI prompt (#33284) chore: add more rules to edge functions AI prompt --- examples/prompts/edge-functions.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/prompts/edge-functions.md b/examples/prompts/edge-functions.md index e0007ba82a0..88131194603 100644 --- a/examples/prompts/edge-functions.md +++ b/examples/prompts/edge-functions.md @@ -17,6 +17,9 @@ You're an expert in writing TypeScript and Deno JavaScript runtime. Generate **h * SUPABASE_SERVICE_ROLE_KEY * SUPABASE_DB_URL 9. To set other environment variables (ie. secrets) users can put them in a env file and run the `supabase secrets set --env-file path/to/env-file` +10. A single Edge Function can handle multiple routes. It is recommended to use a library like Express or Hono to handle the routes as it's easier for developer to understand and maintain. Each route must be prefixed with `/function-name` so they are routed correctly. +11. File write operations are ONLY permitted on `/tmp` directory. You can use either Deno or Node File APIs. +12. Use `EdgeRuntime.waitUntil(promise)` static method to run long-running tasks in the background without blocking response to a request. Do NOT assume it is available in the request / execution context. ## Example Templates