refinedev/refine · error · Error

'getApiUrl' method is not implemented on refine-appwrite dat

Error message

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

What it means

The Appwrite data provider throws on the optional `getApiUrl` method because Appwrite's SDK talks to a per-project endpoint via its client, not a single REST base URL usable generically. Anything calling `dataProvider.getApiUrl()` on a refine-appwrite provider gets this thrown Error.

Source

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

        ids.map((id) =>
          database.updateDocument<any>(
            databaseId,
            resource,
            id.toString(),
            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. Guard with `typeof dataProvider.getApiUrl === 'function'` before calling
  2. Use your configured Appwrite endpoint (the Client set with setEndpoint/setProject) instead of getApiUrl
  3. Move URL-dependent features to a provider that implements them, keeping appwrite only for its resources

Example fix

// before
const base = dataProvider.getApiUrl();
// after
const base =
  typeof dataProvider.getApiUrl === 'function'
    ? dataProvider.getApiUrl()
    : process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT!;
Defensive patterns

Strategy: type-guard

Validate before calling

if (typeof dataProvider.getApiUrl !== 'function') {
  apiUrl = process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT!;
}

Type guard

const supportsGetApiUrl = (dp: unknown): dp is { getApiUrl: () => string } =>
  typeof (dp as any)?.getApiUrl === 'function';

Try / catch

try {
  url = dataProvider.getApiUrl();
} catch {
  url = process.env.APPWRITE_ENDPOINT!;
}

Prevention

When it happens

Trigger: Invoking `getApiUrl()` on the refine-appwrite data provider — commonly from an authProvider or upload helper copied from REST-provider examples, or generic code that assumes every provider exposes an API URL.

Common situations: Combining Appwrite as data provider with a custom auth flow that builds URLs from getApiUrl; refactoring from simple-rest to appwrite without removing getApiUrl usage.

Related errors


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