Add detailed debug info to edge function response
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -88,16 +88,30 @@ serve(async (req: Request): Promise<Response> => {
|
||||
// Clone the request to avoid stream consumption issues
|
||||
// Read body text first, then parse JSON
|
||||
let body: CreateMeetRequest;
|
||||
let debugInfo: any = {
|
||||
method: req.method,
|
||||
headers: Object.fromEntries(req.headers.entries()),
|
||||
contentType: req.headers.get("content-type"),
|
||||
bodyConsumed: false
|
||||
};
|
||||
|
||||
try {
|
||||
debugInfo.bodyReadAttempt = "Starting req.text()";
|
||||
const bodyText = await req.text();
|
||||
debugInfo.bodyLength = bodyText.length;
|
||||
debugInfo.bodyPreview = bodyText.substring(0, 200);
|
||||
console.log("Raw body text:", bodyText.substring(0, 100) + "...");
|
||||
body = JSON.parse(bodyText);
|
||||
debugInfo.parsedBody = body;
|
||||
} catch (bodyError) {
|
||||
debugInfo.readError = (bodyError as Error).message;
|
||||
console.error("Error reading body:", bodyError);
|
||||
console.error("Debug info:", JSON.stringify(debugInfo, null, 2));
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
success: false,
|
||||
message: "Invalid request body: " + (bodyError as Error).message
|
||||
message: "Invalid request body: " + (bodyError as Error).message,
|
||||
debug: debugInfo
|
||||
}),
|
||||
{ status: 400, headers: { ...corsHeaders, "Content-Type": "application/json" } }
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user