gatsbyjs/gatsby · error

Calling `${actionName}` in the `${api}` API is deprecated. P

Error message

Calling `${actionName}` in the `${api}` API is deprecated. Please use: ${allowedIn.map(a => `${a}`).join(`, `)}.

What it means

withDeprecationWarning wraps restricted action creators: when a deprecated action is invoked from a given API context (e.g. sourceNodes vs createPages), it warns that this API usage is deprecated and lists the API(s) where the action is still allowed. The action still executes; this is a migration nudge emitted by Gatsby's action-restriction layer.

Source

Thrown at packages/gatsby/src/redux/actions/restricted.ts:570

    const urls = Array.isArray(url) ? url : [url]
    return {
      type: `ADD_REMOTE_FILE_ALLOWED_URL`,
      payload: { urls },
      plugin,
      traceId,
    }
  },
}

const withDeprecationWarning =
  (
    actionName: RestrictionActionNames,
    action: SomeActionCreator,
    api: API,
    allowedIn: Array<API>
  ): SomeActionCreator =>
  (...args: Array<any>): ReturnType<ActionCreator<any>> => {
    report.warn(
      `Calling \`${actionName}\` in the \`${api}\` API is deprecated. ` +
        `Please use: ${allowedIn.map(a => `\`${a}\``).join(`, `)}.`
    )
    return action(...args)
  }

const withErrorMessage =
  (actionName: RestrictionActionNames, api: API, allowedIn: Array<API>) =>
  () =>
  // return a thunk that does not dispatch anything
  (): void => {
    report.error(
      `\`${actionName}\` is not available in the \`${api}\` API. ` +
        `Please use: ${allowedIn.map(a => `\`${a}\``).join(`, `)}.`
    )
  }

const nodeAPIs = Object.keys(require(`../../utils/api-node-docs`))

View on GitHub (pinned to e85d62f177)

Solutions

  1. Move the action call into one of the allowed APIs listed in the message (e.g. createPages instead of sourceNodes)
  2. Restructure gatsby-node so side effects run in the recommended API
  3. Track plugin updates that remove the deprecated call
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at packages/gatsby/src/redux/actions/restricted.ts:570 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/3ea18985cd9532fd. Report an issue: GitHub.