cube-js/cube · error

Transport does not support streaming

Error message

Transport does not support streaming

What it means

cubeSqlStream() requires a transport implementing requestStream(). If the transport lacks it (e.g. plain HttpTransport without streaming support), the method throws immediately since JSONL streaming cannot be performed.

Source

Thrown at packages/cubejs-client-core/src/index.ts:881

        return {
          schema: parsedSchema.schema,
          data: rows,
          ...(parsedSchema.lastRefreshTime ? { lastRefreshTime: parsedSchema.lastRefreshTime } : {}),
        };
      },
      options,
      callback
    );
  }

  /**
   * Execute a Cube SQL query against Cube SQL interface and return streaming results as an async generator.
   * The server returns JSONL (JSON Lines) format with schema first, then data rows.
   */
  public async* cubeSqlStream(sqlQuery: string, options?: CubeSqlOptions): AsyncGenerator<CubeSqlStreamChunk> {
    if (!this.transport.requestStream) {
      throw new Error('Transport does not support streaming');
    }

    const streamResponse = this.transport.requestStream('cubesql', {
      method: 'POST',
      signal: options?.signal,
      fetchTimeout: options?.timeout,
      baseRequestId: uuidv4(),
      params: {
        query: sqlQuery,
        cache: options?.cache,
        timezone: options?.timezone,
      }
    });

    const decoder = new TextDecoder();
    let buffer = '';

    try {

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Use the built-in HttpTransport (or WebSocketTransport if supported) from a current cubejs-client-core version
  2. Upgrade cubejs-client-core and related packages to a version whose transports support requestStream
  3. If using a custom transport, implement requestStream(method, params) returning { subscribe, unsubscribe }
  4. Use non-streaming cubeSql() if streaming is not required

Example fix

// before
const client = new CubejsClient({ apiUrl, transport: { request: (m, p) => fetch(...) } });
await client.cubeSqlStream(sql);
// after
import { HttpTransport } from '@cubejs-client/core';
const transport = new HttpTransport({ authorization: token, apiUrl });
const client = new CubejsClient({ apiUrl, transport });
await client.cubeSqlStream(sql);
Defensive patterns

Strategy: validation

Validate before calling

if (typeof client.transport?.requestStream !== 'function') {
  throw new Error('Transport lacks streaming support; use HttpTransport from @cubejs-client/core');
}

Type guard

function supportsStreaming(transport) {
  return !!transport && typeof transport.requestStream === 'function';
}

Try / catch

try { const stream = client.cubeSqlStream(sql); } catch (e) {
  if (e.message === 'Transport does not support streaming') {
    const res = await client.cubeSql(sql); // fallback to non-streaming
  } else throw e;
}

Prevention

When it happens

Trigger: Calling cubeSqlStream() with a custom/legacy transport object that only implements request(), or an outdated HttpTransport version without requestStream.

Common situations: Using an older cubejs-client-core/transport version predating streaming; passing a hand-rolled fetch wrapper as transport; mocking transports in tests without requestStream.

Related errors


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/d3b9e5cc456fdb56. Report an issue: GitHub.