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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user