gatsby: Image processing with wordpress-source-plugin attempts to load a non existent image from a production origin the 404 breaks the build

Preliminary Checks

Description

We upgraded to Gatsby 4 using Wordpress as a source. The wordpress-source-plugin would not allow the site to build, failing on a 404 when trying to reach an image at our production origin.

ERROR 

UNHANDLED REJECTION Unable to fetch:
https://my-site-production-url.com/static/ca2024176ddadfa27e5076b99a35845e/fec39/same-image-every-time.jpg
---
Reason: Response code 404 (Not Found)
---
Fetch details:
{
  "attempt": 3,
  "method": "GET",
  "errorCode": "ERR_NON_2XX_3XX_RESPONSE",
  "responseStatusCode": 404,
  "responseStatusMessage": "Not Found",
  "requestHeaders": {
    "user-agent": "got (https://github.com/sindresorhus/got)",
    "accept-encoding": "gzip, deflate, br"
  },
  "responseHeaders": {
    "age": "67547",
    "cache-control": "public, max-age=0, must-revalidate",
    "content-encoding": "br",
    "content-length": "66710",
    "content-type": "text/html; charset=utf-8",
    "date": "Mon, 27 Jun 2022 21:34:44 GMT",
    "etag": "1566246746-ssl-df",
    "referrer-policy": "same-origin",
    "server": "Netlify",
    "strict-transport-security": "max-age=31536000",
    "vary": "Accept-Encoding",
    "x-content-type-options": "nosniff",
    "x-frame-options": "DENY",
    "x-nf-request-id": "01G6NHTHMMGPVT678ZG713JRV7",
    "x-xss-protection": "1; mode=block",
    "connection": "close"
  }
}
---



  WorkerError: Unable to fetch:
  https://my-site-production-url.com/static/ca2024176ddadfa27e5076b99a35845e/fec39/same-image-every-time.jpg
  ---
  Reason: Response code 404 (Not Found)
  ---
  Fetch details:
  {
    "attempt": 3,
    "method": "GET",
    "errorCode": "ERR_NON_2XX_3XX_RESPONSE",
    "responseStatusCode": 404,
    "responseStatusMessage": "Not Found",
    "requestHeaders": {
      "user-agent": "got (https://github.com/sindresorhus/got)",
      "accept-encoding": "gzip, deflate, br"
    },
    "responseHeaders": {
      "age": "67547",
      "cache-control": "public, max-age=0, must-revalidate",
      "content-encoding": "br",
      "content-length": "66710",
      "content-type": "text/html; charset=utf-8",
      "date": "Mon, 27 Jun 2022 21:34:44 GMT",
      "etag": "1566246746-ssl-df",
      "referrer-policy": "same-origin",
      "server": "Netlify",
      "strict-transport-security": "max-age=31536000",
      "vary": "Accept-Encoding",
      "x-content-type-options": "nosniff",
      "x-frame-options": "DENY",
      "x-nf-request-id": "01G6NHTHMMGPVT678ZG713JRV7",
      "x-xss-protection": "1; mode=block",
      "connection": "close"
    }
  }
  ---
  
  - manager.ts:311 enqueueJob
    [v4]/[gatsby]/src/utils/jobs/manager.ts:311:21
  

not finished source and transform nodes - 252.672s
not finished  gatsby-source-wordpress  fetching nodes - 248.065s - 1684 total
not finished Downloading remote files - 246.715s
not finished  gatsby-source-wordpress  creating nodes - 220.565s
not finished  gatsby-source-wordpress  MediaItem - 220.569s - fetched 1115
not finished Running gatsby.IMAGE_CDN jobs - 218.858s
not finished Running gatsby.FILE_CDN jobs - 218.747s

The image url does not exist and it was the same url every time. We do not have Gatsby Image CDN turned on.

Adding these options to the wordpress configuration fixes the issues by not downloading and processing images.

html: {
  useGatsbyImage: false,
  createStaticFiles: false
}

There is a discussion about this issue in this thread https://wp-graphql.slack.com/archives/CJUBND25R/p1656433723880629

Reproduction Link

Since this reproduction would require a Wordpress instance, I am not including a repository. I can provide any details that would help

Steps to Reproduce

  1. Install latest plugins for Gatsby and Wordpress
  2. Deploy site on Gatsby Cloud
  3. Run a build using image processing

Expected Result

No error, site builds and processes images from Wordpress.

Actual Result

Once it gets to the processing of images from Wordpress we get this error.

ERROR 

UNHANDLED REJECTION Unable to fetch:
https://my-site-production-url.com/static/ca2024176ddadfa27e5076b99a35845e/fec39/same-image-every-time.jpg
---
Reason: Response code 404 (Not Found)
---
Fetch details:
{
  "attempt": 3,
  "method": "GET",
  "errorCode": "ERR_NON_2XX_3XX_RESPONSE",
  "responseStatusCode": 404,
  "responseStatusMessage": "Not Found",
  "requestHeaders": {
    "user-agent": "got (https://github.com/sindresorhus/got)",
    "accept-encoding": "gzip, deflate, br"
  },
  "responseHeaders": {
    "age": "67547",
    "cache-control": "public, max-age=0, must-revalidate",
    "content-encoding": "br",
    "content-length": "66710",
    "content-type": "text/html; charset=utf-8",
    "date": "Mon, 27 Jun 2022 21:34:44 GMT",
    "etag": "1566246746-ssl-df",
    "referrer-policy": "same-origin",
    "server": "Netlify",
    "strict-transport-security": "max-age=31536000",
    "vary": "Accept-Encoding",
    "x-content-type-options": "nosniff",
    "x-frame-options": "DENY",
    "x-nf-request-id": "01G6NHTHMMGPVT678ZG713JRV7",
    "x-xss-protection": "1; mode=block",
    "connection": "close"
  }
}
---



  WorkerError: Unable to fetch:
  https://my-site-production-url.com/static/ca2024176ddadfa27e5076b99a35845e/fec39/same-image-every-time.jpg
  ---
  Reason: Response code 404 (Not Found)
  ---
  Fetch details:
  {
    "attempt": 3,
    "method": "GET",
    "errorCode": "ERR_NON_2XX_3XX_RESPONSE",
    "responseStatusCode": 404,
    "responseStatusMessage": "Not Found",
    "requestHeaders": {
      "user-agent": "got (https://github.com/sindresorhus/got)",
      "accept-encoding": "gzip, deflate, br"
    },
    "responseHeaders": {
      "age": "67547",
      "cache-control": "public, max-age=0, must-revalidate",
      "content-encoding": "br",
      "content-length": "66710",
      "content-type": "text/html; charset=utf-8",
      "date": "Mon, 27 Jun 2022 21:34:44 GMT",
      "etag": "1566246746-ssl-df",
      "referrer-policy": "same-origin",
      "server": "Netlify",
      "strict-transport-security": "max-age=31536000",
      "vary": "Accept-Encoding",
      "x-content-type-options": "nosniff",
      "x-frame-options": "DENY",
      "x-nf-request-id": "01G6NHTHMMGPVT678ZG713JRV7",
      "x-xss-protection": "1; mode=block",
      "connection": "close"
    }
  }
  ---
  
  - manager.ts:311 enqueueJob
    [v4]/[gatsby]/src/utils/jobs/manager.ts:311:21
  

not finished source and transform nodes - 252.672s
not finished  gatsby-source-wordpress  fetching nodes - 248.065s - 1684 total
not finished Downloading remote files - 246.715s
not finished  gatsby-source-wordpress  creating nodes - 220.565s
not finished  gatsby-source-wordpress  MediaItem - 220.569s - fetched 1115
not finished Running gatsby.IMAGE_CDN jobs - 218.858s
not finished Running gatsby.FILE_CDN jobs - 218.747s

Environment

System:
    OS: macOS 11.6.1
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.15.1 - ~/.nvm/versions/node/v16.15.1/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v16.15.1/bin/yarn
    npm: 8.11.0 - ~/.nvm/versions/node/v16.15.1/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 103.0.5060.114
    Firefox: 101.0.1
    Safari: 14.1.2
  npmPackages:
    gatsby: ^4.18.0 => 4.18.0
    gatsby-background-image: ^1.6.0 => 1.6.0
    gatsby-background-image-es5: ^1.6.0 => 1.6.0
    gatsby-image: ^3.11.0 => 3.11.0
    gatsby-link: ^4.18.0 => 4.18.0
    gatsby-plugin-eslint: ^4.0.2 => 4.0.2
    gatsby-plugin-force-trailing-slashes: ^1.0.6 => 1.0.6
    gatsby-plugin-gatsby-cloud: ^4.18.0 => 4.18.0
    gatsby-plugin-i18n: ^1.0.1 => 1.0.1
    gatsby-plugin-image: ^2.18.0 => 2.18.0
    gatsby-plugin-iubenda-cookie-footer: ^1.4.0 => 1.4.0
    gatsby-plugin-manifest: ^4.18.0 => 4.18.0
    gatsby-plugin-netlify: ^5.0.0 => 5.0.0
    gatsby-plugin-postcss: ^5.18.0 => 5.18.0
    gatsby-plugin-react-helmet: ^5.18.0 => 5.18.0
    gatsby-plugin-react-svg: ^3.1.0 => 3.1.0
    gatsby-plugin-recaptcha: ^1.0.5 => 1.0.5
    gatsby-plugin-remove-console: ^0.0.2 => 0.0.2
    gatsby-plugin-remove-trailing-slashes: ^4.18.0 => 4.18.0
    gatsby-plugin-sharp: ^4.18.0 => 4.18.0
    gatsby-plugin-sitemap: ^5.18.0 => 5.18.0
    gatsby-plugin-styled-components: ^5.18.0 => 5.18.0
    gatsby-source-contentful: ^7.16.0 => 7.16.0
    gatsby-source-filesystem: ^4.18.0 => 4.18.0
    gatsby-source-hubspot: ^2.3.0 => 2.3.0
    gatsby-source-wordpress: ^6.18.0 => 6.18.0
    gatsby-transformer-remark: ^5.18.0 => 5.18.0
    gatsby-transformer-sharp: ^4.18.0 => 4.18.0
  npmGlobalPackages:
    gatsby: 4.18.0

Config Flags

No flags used

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 3
  • Comments: 16 (1 by maintainers)

Most upvoted comments

Still an issue last I checked.