{"record":{"id":"2da6a6b6703798df","repo":"gatsbyjs/gatsby","slug":"babelpluginremovegraphqlqueries-the-config-expo","errorCode":null,"errorMessage":"BabelPluginRemoveGraphQLQueries: the \"config\" export must be async when using it with graphql","messagePattern":"BabelPluginRemoveGraphQLQueries: the \"config\" export must be async when using it with graphql","errorType":"exception","errorClass":"ExportIsNotAsyncError","httpStatus":null,"severity":"error","filePath":"packages/babel-plugin-remove-graphql-queries/src/index.ts","lineNumber":620,"sourceCode":"        })\n        tagsToRemoveImportsFrom.forEach(removeImport)\n      },\n    },\n  }\n}\n\nfunction isWithinConfigExport(\n  path: NodePath<TaggedTemplateExpression>\n): boolean {\n  const parentExport = path.findParent(parent =>\n    parent.isExportNamedDeclaration()\n  ) as NodePath<ExportNamedDeclaration> | null\n\n  const declaration = parentExport?.node?.declaration\n\n  if (isFunctionDeclaration(declaration) && declaration.id?.name === `config`) {\n    if (!declaration.async) {\n      throw new ExportIsNotAsyncError(`config`, declaration.loc?.start)\n    }\n    return true\n  }\n  if (\n    isVariableDeclaration(declaration) &&\n    isIdentifier(declaration.declarations[0]?.id) &&\n    declaration.declarations[0]?.id?.name === `config`\n  ) {\n    const init = declaration.declarations[0]?.init\n    if (!isFunction(init) || !init.async) {\n      throw new ExportIsNotAsyncError(`config`, init?.loc?.start)\n    }\n    return true\n  }\n  return false\n}\n\nexport {","sourceCodeStart":602,"sourceCodeEnd":638,"githubUrl":"https://github.com/gatsbyjs/gatsby/blob/e85d62f1779e353eaac1753211629a26d123e26c/packages/babel-plugin-remove-graphql-queries/src/index.ts#L602-L638","documentation":"isWithinConfigExport inspects an export named 'config' in a page/shadowable module used with graphql. Gatsby requires such a config export to be declared async (it may query GraphQL), so a synchronous `export function config` or `export const config =` form triggers ExportIsNotAsyncError at that location.","triggerScenarios":"Thrown at packages/babel-plugin-remove-graphql-queries/src/index.ts:620 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Make the config export async: `export async function config(args)`","Keep graphql calls inside the async config function","Restart the dev server or re-run build after fixing the export"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e85d62f1779e353eaac1753211629a26d123e26c","analyzedAt":"2026-08-26T17:50:09.662Z","contentChangedAt":"2026-08-26T17:50:09.662Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}