gatsbyjs/gatsby · error

LMDB and other modules with native dependencies are not…

Error message

LMDB and other modules with native dependencies are not supported in Gatsby Functions.\nIf you are importing utils from `gatsby-core-utils`, make sure to import from a specific module (for example `gatsby-core-utils/create-content-digest`).

What it means

A webpack IgnorePlugin checkResource hook, used while bundling Gatsby Functions, intercepts imports of `lmdb` (a native-dependency module that cannot run inside the Functions bundle). When user function code (often transitively via gatsby-core-utils) requires lmdb, the build warns and the import is ignored/externalized rather than bundled.

Solutions

  1. Import specific submodules from gatsby-core-utils (e.g. gatsby-core-utils/create-content-digest) instead of the index
  2. Remove or lazy-load lmdb-based persistence from code used inside Gatsby Functions
  3. Move native-dependency work to gatsby-node or a build step rather than a runtime function
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/gatsby/src/internal-plugins/functions/gatsby-node.ts:413 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/7d0cd725711e738c. Report an issue: GitHub.

Appendix: source

Thrown at packages/gatsby/src/internal-plugins/functions/gatsby-node.ts:413

              presets: [
                gatsbyPluginTSRequire.resolve(`@babel/preset-typescript`),
              ],
            },
          },
        },
      ],
    },
    plugins: [
      new webpack.DefinePlugin({
        PREFIX_TO_STRIP: JSON.stringify(
          program.prefixPaths ? pathPrefix?.replace(/(^\/+|\/+$)/g, ``) : ``
        ),
        ...processEnvVars,
      }),
      new webpack.IgnorePlugin({
        checkResource(resource): boolean {
          if (resource === `lmdb`) {
            reporter.warn(
              `LMDB and other modules with native dependencies are not supported in Gatsby Functions.\nIf you are importing utils from \`gatsby-core-utils\`, make sure to import from a specific module (for example \`gatsby-core-utils/create-content-digest\`).`
            )
            return true
          }
          return false
        },
      }),
    ],
  }
}

let isFirstBuild = true
export async function onPreBootstrap({
  reporter,
  store,
  parentSpan,
}: ParentSpanPluginArgs): Promise<void> {
  const activity = reporter.activityTimer(`Compiling Gatsby Functions`, {

View on GitHub (pinned to e85d62f177)