gatsbyjs/gatsby · error

`${warning.property}` property of exported config in `${func

Error message

`${warning.property}` property of exported config in `${functionObj.originalRelativeFilePath}` is misconfigured.\nExpected object:\n\n${warning.expectedType}\n\nGot:\n\n${warning.original}\n\nUsing default:\n\n${warning.replacedWith}

What it means

printConfigWarnings reports that an API function's exported `config` object has a property (e.g. `status`, `headers`, API route config fields) of the wrong shape. Gatsby validates the config, prints expected vs. actual, and falls back to the default value instead of crashing the function.

Source

Thrown at packages/gatsby/src/internal-plugins/functions/middleware.ts:55

type IGatsbyMiddleware = (
  req: IGatsbyInternalRequest,
  res: Response,
  next: NextFunction
) => Promise<void> | void

interface ICreateMiddlewareConfig {
  getFunctions: () => Array<IGatsbyFunction>
  prepareFn?: (functionObj: IGatsbyFunction) => Promise<void> | void
  showDebugMessageInResponse?: boolean
}

export function printConfigWarnings(
  warnings: Array<IAPIFunctionWarning>,
  functionObj: IGatsbyFunction
): void {
  if (warnings.length) {
    for (const warning of warnings) {
      reporter.warn(
        `${
          warning.property
            ? `\`${warning.property}\` property of exported config`
            : `Exported config`
        } in \`${
          functionObj.originalRelativeFilePath
        }\` is misconfigured.\nExpected object:\n\n${
          warning.expectedType
        }\n\nGot:\n\n${JSON.stringify(
          warning.original
        )}\n\nUsing default:\n\n${JSON.stringify(
          warning.replacedWith,
          null,
          2
        )}`
      )
    }
  }

View on GitHub (pinned to e85d62f177)

Solutions

  1. Correct the exported config property to match the documented expected type
  2. Compare the printed `Got` vs `Expected` blocks to spot the malformed field
  3. Delete the invalid property to rely on the default shown in `Using default`
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/gatsby/src/internal-plugins/functions/middleware.ts:55 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of gatsbyjs/gatsby@e85d62f177 (2026-08-26). Data as JSON: /api/errors/c0fcae52a5a774e3. Report an issue: GitHub.