gatsbyjs/gatsby · error
createNodeId must be a function, was ${typeof createNodeId}
Error message
createNodeId must be a function, was ${typeof createNodeId} What it means
The gatsby-source-wordpress vendored copy of createRemoteFileNode validates createNodeId exactly like the upstream gatsby-source-filesystem version. After URL encoding, it asserts typeof createNodeId === 'function'. Non-function values are rejected with their runtime type. This guard is the first of three input validations (createNodeId, createNode, cache).
Source
Thrown at packages/gatsby-source-wordpress/src/steps/source-nodes/create-nodes/create-remote-file-node/index.js:406
if (doneQueueTimeout) {
// this is to give the bar a little time to wait when there are pauses
// between file downloads.
clearTimeout(doneQueueTimeout)
}
// if the url isn't already encoded
// so decoding it doesn't do anything
if (decodeURI(url) === url) {
// encode the uri
// this accounts for special characters in filenames
url = encodeURI(url)
}
// validation of the input
// without this it's notoriously easy to pass in the wrong `createNodeId`
// see gatsbyjs/gatsby#6643
if (typeof createNodeId !== `function`) {
throw new Error(
`createNodeId must be a function, was ${typeof createNodeId}`
)
}
if (typeof createNode !== `function`) {
throw new Error(`createNode must be a function, was ${typeof createNode}`)
}
if (typeof getCache === `function`) {
// use cache of this plugin and not cache of function caller
cache = getCache(`gatsby-source-filesystem`)
}
if (typeof cache !== `object`) {
throw new Error(
`Neither "cache" or "getCache" was passed. getCache must be function that return Gatsby cache, "cache" must be the Gatsby cache, was ${typeof cache}`
)
}
// Check if we already requested node for this remote file
// and return stored promise if we did.View on GitHub (pinned to 8b06340921)
Solutions
- If you are a user, this is almost always a gatsby-source-wordpress internal bug — upgrade to the latest version.
- If forking, ensure createNodeId is forwarded from helpers into the createRemoteFileNode call site.
- Verify your Gatsby version is compatible with the gatsby-source-wordpress version in use.
- Check that WPGQL is actually returning media items; an upstream change should not remove createNodeId but a stale cache of helpers can.
Example fix
null
Defensive patterns
Strategy: validation
Validate before calling
if (typeof createNodeId !== 'function') { throw new TypeError('createNodeId not available in the WordPress media step') } Type guard
const isCreateNodeId = (v) => typeof v === 'function'
Try / catch
null
Prevention
- Upgrade gatsby-source-wordpress to the latest version when this fires
- Confirm Gatsby core and gatsby-source-wordpress are version-compatible
- If forking, always forward createNodeId from helpers into the media step
When it happens
Trigger: gatsby-source-wordpress calling its internal createRemoteFileNode without forwarding createNodeId; a custom integration passing createNodeId: undefined; calling the function directly from user code without Gatsby helpers.
Common situations: Internal plugin bug where helpers were not threaded through to the media step; forking gatsby-source-wordpress and dropping the createNodeId forwarding; version mismatch between gatsby-source-wordpress and Gatsby core that changes helper availability.
Related errors
- createNodeId must be a function, was ${typeof createNodeId}
- createNode must be a function, was ${typeof createNode}
- Neither "cache" or "getCache" was passed. getCache must be f
- Invalid plugin options for "gatsby-plugin-sitemap":
- The "layout" argument is required for "${source.url}"
AI-assisted analysis of gatsbyjs/gatsby@8b06340921 (2026-08-13).
Data as JSON: /api/errors/8b482d3f03dfa103.
Report an issue: GitHub.