refinedev/refine · error · Error
GraphQL does not support ${method} method.
Error message
GraphQL does not support ${method} method. What it means
The nestjs-query data provider's custom() method only accepts HTTP methods "get" and "post" because those are the only methods meaningful for GraphQL over HTTP. Any other method string (put, delete, patch, or a typo like "GET") throws this error before a request is made.
Source
Thrown at packages/nestjs-query/src/dataProvider/index.ts:426
},
},
};
await client.request<BaseRecord>(query, variables);
return {
data: [],
};
},
getApiUrl: () => {
return (client as any).url; // url field in GraphQLClient is private
},
custom: async ({ url, method, headers, meta }) => {
const SUPPORTED_METHODS = ["get", "post"];
const requestUrl = url || (client as any).url;
if (!SUPPORTED_METHODS.some((it) => it === method)) {
throw Error(`GraphQL does not support ${method} method.`);
}
const validMethod = method as "get" | "post";
const _client = new GraphQLClient(requestUrl, {
...client.requestConfig,
method: validMethod,
headers: { ...client.requestConfig.headers, ...headers },
});
const gqlOperation = meta?.gqlMutation ?? meta?.gqlQuery;
if (gqlOperation) {
const response: any = await _client.request<BaseRecord>({
document: gqlOperation,
variables: meta?.variables,
});
View on GitHub (pinned to 779d52a20e)
Solutions
- Use method: "post" for mutations and "get" for queries
- Verify the method string is lowercase ("get"/"post")
- If you truly need REST verbs, issue the request with your own fetch/axios client
Example fix
// before
await dataProvider.custom({ url: "", method: "delete", meta: { ... } });
// after
await dataProvider.custom({ url: "", method: "post", meta: { operation: "removeUser", fields: ["id"], variables: { id: 1 } } }); Defensive patterns
Strategy: validation
Validate before calling
const ok = method === "get" || method === "post";
if (!ok) throw new Error(`Use get/post, got ${method}`); Type guard
const isSupportedMethod = (m: unknown): m is "get" | "post" => m === "get" || m === "post";
Try / catch
try { await dataProvider.custom({ url, method, meta }); } catch (e) { if (String(e).includes("does not support")) { /* switch to get/post */ } else throw e; } Prevention
- Map all mutations to post and all reads to get in GraphQL providers
- Normalize method strings to lowercase before calling custom()
When it happens
Trigger: Calling dataProvider.custom({ url, method: "put" | "delete" | "patch", ... }) on the nestjs-query provider, including mutations sent with method: "delete" out of REST habit, or uppercase method strings.
Common situations: Porting custom() calls from refine's REST providers where put/delete are normal; sending mutations with delete/put semantics; case-sensitive typos in method.
Related errors
- GraphQL operation name required.
- GraphQL operation name required.
- GraphQL needs operation, fields and variables values in meta
- @packages/hasura: multiple filters present. Group multiple p
- [Code] Not implemented on refine-graphql data provider.
AI-assisted analysis of refinedev/refine@779d52a20e (2026-08-27).
Data as JSON: /api/errors/f0f4884032f7dc03.
Report an issue: GitHub.