Does Upstash’s context.call method support ReadableStream.?

I am using upstash context.call method to call my langgraph server. My langgraph server has an agent that autocompletes the notetext. when I do console.log on my body of context.call i can see the responses but I only see the workflowrunId when i call the route through frontend. Pls help what’s the issue here?


import { serve } from '@upstash/workflow/nextjs';
//import { TextDecoder, TextEncoder } from 'util';

export const { POST } = serve<{ noteText: string }>(
  async (context) => {
    const { noteText } = context.requestPayload;

    const { status, headers, body } = await context.call<ReadableStream>('langgraph-request', {
      url: `${process.env.LANGGRAPH_RUN_URL}/runs/stream`,
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        Authorization: `Bearer ${process.env.LANGSMITH_API_KEY}`,
      },
      body: {
        assistant_id: 'autocomplete_agent',
        input: { note_text: noteText },
        stream_mode: ['updates'],
      },
    });
    console.log('body:', body);

    return body;
  },
  {
    failureFunction: ({ failStatus, failResponse, failHeaders }) => {
      console.error('Autocomplete workflow failed:', {
        status: failStatus,
        response: failResponse,
        headers: failHeaders,
      });
    },
  }
);

My frontend code:

const getSuggestion = debounce(async (noteText: string, cb: (suggestion: string) => void) => {
      try {
        const response = await fetch('/api/workflow/autocomplete/', {
          method: 'POST',
          headers: { 'Content-Type': 'application/json' },
          body: JSON.stringify({ noteText }),
        });

        if (!response.ok || !response.body) {
          throw new Error(`HTTP error! status: ${response.status}`);
        }
        console.log('response body frontend:', response.body.readStreamableValue);

        const reader = response.body.getReader();
        const decoder = new TextDecoder();

        let suggestion = '';

        while (true) {
          const { done, value } = await reader.read();
          if (done) break;
          
          // Directly append the decoded text
          suggestion += decoder.decode(value);
          console.log('suggestion:', suggestion);
          cb(suggestion); // Update UI progressively
        }
        
        cb(suggestion); // Final update
      } catch (err) {
        console.error('Autocomplete failed:', err);
        cb('');
      }
    }, 300);
        
My console.log from route:body: event: metadata
data: {
data:   "run_id": "2d6cf720-42e0-43b1-8650-6196b93db2c5",
data:   "attempt": 1
data: }

event: updates
data: {
data:   "autocompleteNote": {
data:     "note_text": "A ",
data:     "suggested_completion": "<cusor-position> patient presents with persistent symptoms of fatigue and malaise. Vital signs are stable, and a thorough physical examination reveals no acute distress. Laboratory tests, including complete blood count and metabolic panel, are pending. The patient has been advised to maintain hydration and rest while awaiting results. Follow-up appointment scheduled for next week to review test outcomes and adjust management plan as necessary."
data:   }
data: }
but from fronted fetch, this is not being returned. I am simply getting workflowRunId. Please help what could be the issue