gatsbyjs/gatsby · critical

111008

111008

Error message

${e.message}\n\nSee the docs for more information:\nhttps://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-wordpress/docs/tutorials/using-self-signed-certificates.md

What it means

Thrown by gatsby-source-wordpress when a GraphQL fetch to the WordPress instance fails because the server presents a self-signed TLS certificate that Node rejects. The plugin matches the literal substring 'self signed certificate' in the underlying request error's message and panics (halt the build) pointing to the self-signed-cert tutorial. It exists because source plugins cannot safely disable certificate verification without an explicit opt-in.

Source

Thrown at packages/gatsby-source-wordpress/src/utils/fetch-graphql.ts:630

    reporter.log(``)
    if (process.env.NODE_ENV === `development`) {
      reporter.warn(formatLogMessage(sharedEmptyStringReponseError))
    } else {
      reporter.panic({
        id: CODES.BadResponse,
        context: {
          sourceMessage: formatLogMessage(sharedEmptyStringReponseError),
        },
      })

      return
    }

    return
  }

  if (e.message.includes(`self signed certificate`)) {
    reporter.panic({
      id: CODES.SelfSignedCert,
      context: {
        sourceMessage: formatLogMessage(
          `${e.message}\n\nSee the docs for more information:\nhttps://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-source-wordpress/docs/tutorials/using-self-signed-certificates.md`
        ),
      },
    })

    return
  }

  // generic error if none of the above exit the process
  reporter.panic({
    id: CODES.BadResponse,
    context: {
      sourceMessage: formatLogMessage(
        `${e.stack} ${
          errorContext ? `\n\n` + errorContext : ``

View on GitHub (pinned to 8b06340921)

Solutions

  1. Set the environment variable NODE_TLS_REJECT_UNAUTHORIZED=0 only for the local build, or use the plugin's documented option to allow self-signed certs.
  2. Install the self-signed cert / private CA into the OS trust store (or set NODE_EXTRA_CA_CERTS to the CA bundle path) so Node accepts it.
  3. Serve WordPress over plain HTTP during local development, or put it behind a reverse proxy with a valid cert (e.g. Caddy/Let's Encrypt).
  4. Regenerate the cert for the exact hostname you fetch from; mismatched hostnames produce a different error and will not trip this branch.

Example fix

// before: NODE_TLS_REJECT_UNAUTHORIZED unset, build panics
// after (local dev only):
NODE_TLS_REJECT_UNAUTHORIZED=0 gatsby build
// or in gatsby-config.js, per the plugin docs:
resolve: `gatsby-source-wordpress`,
options: { /* schema/develop allow self-signed per plugin docs */ }
Defensive patterns

Strategy: validation

Validate before calling

// Before configuring the plugin, verify the WP endpoint accepts HTTPS
// without a self-signed error:
const https = require('https')
https.get(process.env.WP_GRAPHQL_URL, res => {
  console.log('status', res.statusCode)
}).on('error', e => {
  if (/self signed certificate/i.test(e.message)) {
    console.error('Set NODE_TLS_REJECT_UNAUTHORIZED=0 or install the CA')
  }
})

Prevention

When it happens

Trigger: The HTTPS WPGraphQL endpoint uses a cert that is not signed by a trusted CA (self-signed, or a private CA not in the Node trust store). The fetch-graphql error handler runs, e.message contains 'self signed certificate', and reporter.panic is invoked with code 111008.

Common situations: Local Docker/LocalWP WordPress instances with self-signed certs; staging servers using a corporate/private CA; HTTPS endpoints created by devcert that are not trusted by the Node process; the WP instance was switched from http to https during development.

Understand the failure class

Related errors


AI-assisted analysis of gatsbyjs/gatsby@8b06340921 (2026-08-13). Data as JSON: /api/errors/83c14300eed5100d. Report an issue: GitHub.