refinedev/refine · warning · Error

[Code] Not implemented on refine-graphql data provider.

Error message

[Code] Not implemented on refine-graphql data provider.

What it means

The refine-graphql data provider does not implement the getApiUrl() method required by Refine's DataProvider interface. Calling getApiUrl() always throws because a GraphQL endpoint URL is not tracked by this provider; the provider is a community package with limited coverage. Use your own GraphQL client URL instead.

Source

Thrown at packages/graphql/src/dataProvider/index.ts:257

        return { data: options.custom.dataMapper(response, params) };
      }

      const response = await client
        .query(
          meta.gqlQuery!,
          options.custom.buildVariables(params),
          JSON.parse(JSON.stringify({ url })),
        )
        .toPromise();

      if (response?.error) {
        throw new Error(errorHandler(response?.error));
      }

      return { data: options.custom.dataMapper(response, params) };
    },
    getApiUrl: () => {
      throw Error("[Code] Not implemented on refine-graphql data provider.");
    },
  };
};

export default createDataProvider;

View on GitHub (pinned to 779d52a20e)

Solutions

  1. Store the GraphQL endpoint URL in your own constant/config and use it directly instead of getApiUrl()
  2. If you need getApiUrl(), wrap the provider and implement it: spread the provider and override getApiUrl: () => GRAPHQL_URL
  3. Switch to a data provider that supports getApiUrl (e.g. @refinedev/strapi-graphql or a custom provider)

Example fix

// before
const apiUrl = dataProvider.getApiUrl(); // throws

// after
const apiUrl = "https://api.example.com/graphql";
// or wrap:
const provider = { ...gqlDataProvider, getApiUrl: () => "https://api.example.com/graphql" };
Defensive patterns

Strategy: validation

Validate before calling

const supportsGetApiUrl = (p: unknown): p is { getApiUrl: () => string } =>
  typeof p === "object" && p !== null &&
  "getApiUrl" in p &&
  (() => { try { return typeof (p as any).getApiUrl() === "string"; } catch { return false; } })();
const apiUrl = supportsGetApiUrl(dataProvider) ? dataProvider.getApiUrl() : MY_GRAPHQL_URL;

Try / catch

try { dataProvider.getApiUrl(); } catch (e) { if (String(e).includes("Not implemented")) { /* fall back to your configured GraphQL URL */ } else throw e; }

Prevention

When it happens

Trigger: Calling dataProvider.getApiUrl() on the provider returned by createDataProvider from @refinedev/graphql, e.g. to build custom fetch URLs or in components that assume a REST-style API base.

Common situations: Copying code from a REST-based Refine example (e.g. axios provider) into a GraphQL app; libraries or hooks that call getApiUrl() internally; expecting the community graphql provider to have parity with the core providers.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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