refinedev/refine · error · Error

'custom' method is not implemented on refine-appwrite data p

Error message

'custom' method is not implemented on refine-appwrite data provider.

What it means

The Appwrite data provider does not implement the optional `custom` method of the refine data provider contract; calling it (typically via `useCustom`/`useCustomMutation`) throws `Error("'custom' method is not implemented on refine-appwrite data provider.")`. Appwrite operations go through its typed SDK, so arbitrary URL/method requests aren't supported through this provider.

Source

Thrown at packages/appwrite/src/dataProvider.ts:199

            variables as unknown as object,
            [...readPermissions, ...writePermissions],
          ),
        ),
      );
      return {
        data: data.map(({ $id, ...restData }) => ({
          id: $id,
          ...restData,
        })),
      } as any;
    },
    getApiUrl: () => {
      throw Error(
        "'getApiUrl' method is not implemented on refine-appwrite data provider.",
      );
    },
    custom: () => {
      throw Error(
        "'custom' method is not implemented on refine-appwrite data provider.",
      );
    },
  };
};

View on GitHub (pinned to 779d52a20e)

Solutions

  1. Call Appwrite SDK functions (or Appwrite Functions via sdk.functions.createExecution) directly with react-query instead of useCustom
  2. Expose the needed data as a normal Appwrite collection/database query and use useList/useOne
  3. If a REST surface exists, attach a second dataProvider that supports custom and point those resources at it

Example fix

// before
const { data } = useCustom({ url: '/functions/health', method: 'get' });
// after
const { data } = useQuery({
  queryKey: ['health'],
  queryFn: () => appwriteFunctions.createExecution('health'),
});
Defensive patterns

Strategy: type-guard

Validate before calling

if (typeof dataProvider.custom !== 'function') {
  // call Appwrite SDK directly instead of useCustomMutation
}

Type guard

const supportsCustom = (dp: unknown): dp is { custom: Function } =>
  typeof (dp as any)?.custom === 'function';

Try / catch

try {
  await provider.custom(...args);
} catch (e) {
  if (/not implemented/.test((e as Error).message)) useAppwriteSdk();
  else throw e;
}

Prevention

When it happens

Trigger: Using `useCustom` or `useCustomMutation` hooks in a component while the resource's data provider is refine-appwrite; the hook delegates to provider.custom which throws.

Common situations: Porting useCustom-based features (health checks, custom endpoints, aggregated queries) from REST providers into an Appwrite app; attempting to hit Appwrite functions via refine hooks.

Related errors


AI-assisted analysis of refinedev/refine@779d52a20e (2026-08-27). Data as JSON: /api/errors/3ab72332506533b5. Report an issue: GitHub.