GenkitG
Genkitโ€ข8mo ago
faint-white

I'm struggling to investigate why there'

I'm struggling to investigate why there's a seven-second delay between the final output of a stream and the stream finishing

for await (const chunk of stream) {
  debugLog(`๐Ÿ”Ž RAW CHUNK: ${JSON.stringify(chunk)}`);
  const outputFromPrompt = chunk.output as Schema | null;

  // Skip null/undefined chunks
  if (!outputFromPrompt) {
    continue;
  }

  debugLog('๐Ÿ“ค SENDING: chunk');
  sendChunk(outputFromPrompt);
}

 debugLog('โœ… STREAM FINISHED');


2025-06-10T16:12:49.407Z: ๐Ÿ”Ž RAW CHUNK: {"role":"model","index":0,"content":[{"text":""}]}
2025-06-10T16:12:49.407Z: ๐Ÿ“ค SENDING: chunk
2025-06-10T16:12:56.797Z: โœ… STREAM FINISHED // seven second delay between final chunk and stream finishing
Was this page helpful?