Problem
The supabase/functions/summarize-transcription/ Edge Function accepts
meeting transcription text and passes it to the Gemini API for summarization.
There is no maximum input size check before the function processes the text.
Supabase Edge Functions run on Deno with a memory limit (typically 150MB).
A very long meeting transcription (e.g. a 4-hour all-hands meeting producing
100,000+ tokens) can:
- Exceed the Gemini API's context window, causing the API call to fail with
an unclear error.
- Exhaust the Edge Function's memory limit, causing the function to crash
with a 500 error and no useful error message returned to the client.
- Generate outsized Gemini API charges if the input is not truncated before
billing begins.
Suggested Fix
- Add a hard character limit (e.g. 500,000 characters) to the transcription
input before processing:
const MAX_INPUT_CHARS = 500_000;
if (transcription.length > MAX_INPUT_CHARS) {
return new Response(JSON.stringify({ error: "Transcription too long" }), { status: 413 });
}
- For long transcriptions, implement chunked summarization: split the text
into overlapping chunks, summarize each, then summarize the summaries.
- Return HTTP 413 (Payload Too Large) with a clear message when the limit
is exceeded.
- Document the maximum supported transcription length in
BACKEND.md.
Problem
The
supabase/functions/summarize-transcription/Edge Function acceptsmeeting transcription text and passes it to the Gemini API for summarization.
There is no maximum input size check before the function processes the text.
Supabase Edge Functions run on Deno with a memory limit (typically 150MB).
A very long meeting transcription (e.g. a 4-hour all-hands meeting producing
100,000+ tokens) can:
an unclear error.
with a 500 error and no useful error message returned to the client.
billing begins.
Suggested Fix
input before processing:
into overlapping chunks, summarize each, then summarize the summaries.
is exceeded.
BACKEND.md.