Fix 'Body already consumed' error by using req.clone()

- Use req.clone().json() to handle multiple reads from same request
- This happens when React Strict Mode fires requests twice
- Cloning the request allows reading body multiple times safely
This commit is contained in:
dwindown
2025-12-23 14:52:40 +07:00
parent e2d22088c1
commit cc66e96f61

View File

@@ -85,7 +85,8 @@ serve(async (req: Request): Promise<Response> => {
const supabaseServiceKey = Deno.env.get("SUPABASE_SERVICE_ROLE_KEY")!;
const supabase = createClient(supabaseUrl, supabaseServiceKey);
const body: CreateMeetRequest = await req.json();
// Clone the request before reading body to handle multiple reads
const body: CreateMeetRequest = await req.clone().json();
console.log("Creating Google Meet event for slot:", body.slot_id);
// Get platform settings