marmelab/react-admin · warning

The override option is deprecated. You should instead wrap…

Error message

The override option is deprecated. You should instead wrap the buildQuery function provided by the dataProvider you use.

What it means

buildGraphQLProvider logs a warning (not a throw) when the deprecated override option is passed with non-empty keys in production. override was replaced by the recommended pattern of wrapping the buildQuery function returned by the buildQuery factory before handing it to buildGraphQLProvider.

Solutions

  1. Remove the override option and wrap the buildQuery function instead (intercept operations and adjust queries/types).
  2. If override is only transitional, empty it or gate it to development to silence the warning.
  3. Consult the current ra-data-graphql docs for the buildQuery wrapper API.

Example fix

// before
buildGraphQLProvider({ buildQuery, override: { queries: { allPosts: customQuery } } });
// after
const buildQueryCustom = (introspection) => {
  const bq = buildQuery(introspection);
  return (type, operation) => {
    if (type === 'Post' && operation === 'GET_LIST') return customQuery;
    return bq(type, operation);
  };
};
buildGraphQLProvider({ buildQuery: buildQueryCustom });
Defensive patterns

Strategy: validation

Validate before calling

if (options.override && Object.keys(options.override).length > 0) {
  console.warn('override is deprecated; wrap buildQuery instead');
}

Type guard

const usesDeprecatedOverride = (o: { override?: object }): o is { override: object } => !!o.override && Object.keys(o.override).length > 0;

Try / catch

const warn = jest.spyOn(console, 'warn').mockImplementation();
buildGraphQLProvider(opts);
expect(warn).toHaveBeenCalledWith(expect.stringContaining('override option is deprecated'));

Prevention

When it happens

Trigger: Calling buildGraphQLProvider({ buildQuery, override: { queries: {...}, types: {...} } }) with a non-empty override object while NODE_ENV === 'production'.

Common situations: Upgrading ra-data-graphql: older codebases customized queries/types via override; newer versions require a wrapped buildQuery.

Understand the failure class

Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.

Related errors


AI-assisted analysis of marmelab/react-admin@051f511bb0 (2026-08-30). Data as JSON: /api/errors/cf4aa5aeeea71941. Report an issue: GitHub.

Appendix: source

Thrown at packages/ra-data-graphql/src/index.ts:149

    watchQuery?: GetWatchQueryOptions;
};

const buildGraphQLProvider = (options: Options): GraphqlDataProvider => {
    const {
        client: clientObject,
        clientOptions,
        introspection,
        resolveIntrospection,
        buildQuery: buildQueryFactory,
        override = {},
        ...otherOptions
    } = merge({}, defaultOptions, options);

    if (
        Object.keys(override).length > 0 &&
        process.env.NODE_ENV === 'production'
    ) {
        console.warn(
            'The override option is deprecated. You should instead wrap the buildQuery function provided by the dataProvider you use.'
        );
    }

    const client = clientObject || buildApolloClient(clientOptions);

    let introspectionResults;
    let introspectionResultsPromise;

    const callApollo = async (raFetchMethod, resource, params) => {
        if (introspection) {
            if (!introspectionResultsPromise) {
                introspectionResultsPromise = resolveIntrospection(
                    client,
                    introspection
                );
            }

View on GitHub (pinned to 051f511bb0)