twentyhq/twenty · error · Error

updateProgressFunction is not set

Error message

updateProgressFunction is not set

What it means

Thrown by updateProgress when the host application has not registered an updateProgress function on the global frontComponentHostCommunicationApi. This function lets a front component report progress (a number value) to the Twenty host shell for progress-bar UI updates. If called outside the host context, the function is undefined.

Source

Thrown at packages/twenty-sdk/src/sdk/front-component/functions/updateProgress.ts:13

import { isDefined } from 'twenty-shared/utils';

import {
  frontComponentHostCommunicationApi,
  type UpdateProgressFunction,
} from '../globals/frontComponentHostCommunicationApi';

export const updateProgress: UpdateProgressFunction = (progress) => {
  const updateProgressFunction =
    frontComponentHostCommunicationApi.updateProgress;

  if (!isDefined(updateProgressFunction)) {
    throw new Error('updateProgressFunction is not set');
  }

  return updateProgressFunction(progress);
};

View on GitHub (pinned to 1f5dd2bbd2)

Solutions

  1. Only call updateProgress from event handlers or effects within a host-mounted front component.
  2. In tests, mock the global: (globalThis as any).frontComponentHostCommunicationApi = { updateProgress: jest.fn().mockResolvedValue(undefined) }.
  3. Ensure the host shell initializes frontComponentHostCommunicationApi.updateProgress before mounting front components.
  4. Guard with an isDefined check to no-op when the function is unavailable.

Example fix

// before
import { updateProgress } from 'twenty-sdk';
for (let i = 0; i <= 100; i += 10) {
  await updateProgress(i);
}

// after — guard for non-host environments
import { frontComponentHostCommunicationApi } from 'twenty-sdk';
for (let i = 0; i <= 100; i += 10) {
  if (frontComponentHostCommunicationApi.updateProgress) {
    await frontComponentHostCommunicationApi.updateProgress(i);
  }
}
Defensive patterns

Strategy: type-guard

Validate before calling

import { frontComponentHostCommunicationApi } from 'twenty-sdk';
import { isDefined } from 'twenty-shared/utils';

const canUpdateProgress = (): boolean => {
  return isDefined(frontComponentHostCommunicationApi.updateProgress);
};

if (!canUpdateProgress()) {
  console.debug('Progress reporting unavailable — skipping.');
  return;
}

Type guard

import { isDefined } from 'twenty-shared/utils';
import { frontComponentHostCommunicationApi } from 'twenty-sdk';

const isUpdateProgressAvailable = (): boolean => {
  return isDefined(frontComponentHostCommunicationApi.updateProgress);
};

Try / catch

try {
  await updateProgress(progress);
} catch (error) {
  if (error instanceof Error && error.message === 'updateProgressFunction is not set') {
    console.debug('Progress update not available outside host context.');
    return;
  }
  throw error;
}

Prevention

When it happens

Trigger: Calling updateProgress(progress) before the host has set frontComponentHostCommunicationApi.updateProgress. Happens in non-host environments, during testing without mocks, or when the host bridge is not yet initialized at call time.

Common situations: Unit testing a long-running front component that calls updateProgress without mocking the global API. Calling updateProgress during initial render before the host has wired up the bridge. Running the component in isolation (Storybook) where the host bridge doesn't exist.

Related errors


AI-assisted analysis of twentyhq/twenty@1f5dd2bbd2 (2026-08-12). Data as JSON: /api/errors/c65cbc36502ff9e4. Report an issue: GitHub.