gatsbyjs/gatsby · error

Expected an ID in the format gid://shopify/<typename>/<id>

Error message

Expected an ID in the format gid://shopify/<typename>/<id>

What it means

After assembling a node from bulk results, process-bulk-results validates that result.shopifyId matches the Shopify gid format (gid://shopify/<typename>/<id>) via isShopifyId. If it does not, the plugin cannot synthesize a stable Gatsby node id and throws. The gid is the canonical identity across the Shopify sourcing pipeline.

Source

Thrown at packages/gatsby-source-shopify/src/process-bulk-results.ts:86

          const field = shopifyTypes[childType].key

          if (field) {
            result[field] = [
              typeof child === `string`
                ? createNodeId(child, gatsbyApi, pluginOptions)
                : child,
              ...((result[field] || []) as Array<unknown>),
            ]
          } else {
            throw new Error(
              `There is no shopifyType for child type: ${childType}`
            )
          }
        }
      }

      if (!isShopifyId(result.shopifyId)) {
        throw new Error(
          `Expected an ID in the format gid://shopify/<typename>/<id>`
        )
      }

      const node = {
        ...result,
        id: createNodeId(result.shopifyId, gatsbyApi, pluginOptions),
        internal: {
          type: `${pluginOptions.typePrefix}Shopify${type}`,
          contentDigest: gatsbyApi.createContentDigest(result),
        },
      } as IShopifyNode

      if (pluginOptions.downloadImages && imageFields) {
        promises.push(
          processShopifyImages(gatsbyApi, node).then(() =>
            gatsbyApi.actions.createNode(node)
          )

View on GitHub (pinned to 8b06340921)

Solutions

  1. Inspect the JSONL bulk result line that produced the node to see the actual id value.
  2. Ensure queries include the `id` field for every type sourced from bulk operations.
  3. Confirm the Shopify object genuinely has a gid (custom objects may not).
  4. Filter out objects whose id does not match gid://shopify/... before they reach this builder.

Example fix

null
Defensive patterns

Strategy: validation

Validate before calling

function isShopifyId(id) { return /^gid:\/\/shopify\/[A-Za-z]+\/\d+/.test(id) }
if (!isShopifyId(result.shopifyId)) { reporter.warn('Non-gid id encountered; skipping node'); return }

Type guard

const isShopifyGid = (id) => typeof id === 'string' && /^gid:\/\/shopify\/[A-Za-z]+\/\d+$/.test(id)

Try / catch

try { buildNode(result) } catch (e) { if (/Expected an ID in the format gid:\/\/shopify/.test(e.message)) { reporter.warn('Skipping non-gid Shopify object'); return } throw e }

Prevention

When it happens

Trigger: A bulk result object lacks an id field; id field is a plain integer or non-gid string; __typename maps to a typename that does not appear in the gid; upstream Shopify data returns a malformed or partial gid.

Common situations: Custom mutations on Shopify returning non-standard ids; third-party app overriding the id field; querying a type whose bulk export omits id; bulk result line corrupted by truncation.

Related errors


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