cube-js/cube · error · Error

options.sqlApiLoad must be a function

Error message

options.sqlApiLoad must be a function

What it means

Configuration guard in registerInterface (cubejs-backend-native): fires when the options object lacks a `sqlApiLoad` function. The native SQL API bridge requires this callback to load query results, so a missing one means the interface cannot serve SQL load requests.

Source

Thrown at packages/cubejs-backend-native/js/index.ts:408

  if (typeof options.checkAuth !== 'function') {
    throw new Error('options.checkAuth must be a function');
  }

  if (typeof options.checkSqlAuth !== 'function') {
    throw new Error('options.checkSqlAuth must be a function');
  }

  if (typeof options.meta !== 'function') {
    throw new Error('options.meta must be a function');
  }

  if (typeof options.stream !== 'function') {
    throw new Error('options.stream must be a function');
  }

  if (typeof options.sqlApiLoad !== 'function') {
    throw new Error('options.sqlApiLoad must be a function');
  }

  if (typeof options.sqlGenerators !== 'function') {
    throw new Error('options.sqlGenerators must be a function');
  }

  if (typeof options.sql !== 'function') {
    throw new Error('options.sql must be a function');
  }

  const native = loadNative();
  return native.registerInterface({
    ...options,
    contextToApiScopes: wrapNativeFunctionWithChannelCallback(options.contextToApiScopes),
    checkAuth: wrapNativeFunctionWithChannelCallback(options.checkAuth),
    checkSqlAuth: wrapNativeFunctionWithChannelCallback(options.checkSqlAuth),
    sql: wrapNativeFunctionWithChannelCallback(options.sql),
    meta: wrapNativeFunctionWithChannelCallback(options.meta),

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Provide an sqlApiLoad async function in the options passed to registerInterface.
  2. Confirm the wiring code that builds the options object actually assigns sqlApiLoad.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/cubejs-backend-native/js/index.ts:408 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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