Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gatsby build fails with 403 errors for public Cloudflare URLs, but gatsby develop works fine #39221

Open
macphersonj opened this issue Jan 24, 2025 · 1 comment
Labels
status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer

Comments

@macphersonj
Copy link

macphersonj commented Jan 24, 2025

I’m using gatsby-source-wordpress with a WordPress plugin that offloads media to Cloudflare. Locally, gatsby develop everything works seamlessly, but during gatsby build (locally and on CloudFlare pages) I get 403 errors when fetching public Cloudflare media URLs.

The urls throwing 403s are available publically (in the browser) and in development using gatsby develop
The build process fails when trying to fetch the same public URLs.
Disabling the plugin, the build works fine fetching wordpressurl.wp-content/image.jpg

UNHANDLED REJECTION Unable to fetch:
--
21:20:56.115 | https://myurl.com/cdn-cgi/imagedelivery/C0CVdrx_rVIRtuo1zANchA/b3d5d51d-9b7
21:20:56.116 | a-446e-aaac-e1aa6ea7d400/w=1333,h=1000
21:20:56.116 | ---
21:20:56.116 | Reason: Response code 403 (Forbidden)
21:20:56.116 | ---
21:20:56.116 | Fetch details:
21:20:56.116 | {
21:20:56.116 | "attempt": 3,
21:20:56.116 | "method": "GET",
21:20:56.116 | "errorCode": "ERR_NON_2XX_3XX_RESPONSE",
21:20:56.116 | "responseStatusCode": 403,
21:20:56.116 | "responseStatusMessage": "Forbidden",
21:20:56.116 | "requestHeaders": {
21:20:56.116 | "user-agent": "got (https://github.com/sindresorhus/got)",
21:20:56.117 | "accept-encoding": "gzip, deflate, br"
21:20:56.117 | },
21:20:56.117 | "responseHeaders": {
21:20:56.117 | "date": "Thu, 23 Jan 2025 10:20:56 GMT",
21:20:56.117 | "content-type": "text/html; charset=UTF-8",
21:20:56.117 | "transfer-encoding": "chunked",
21:20:56.117 | "connection": "close",
21:20:56.117 | "x-frame-options": "SAMEORIGIN",
21:20:56.117 | "referrer-policy": "same-origin",
21:20:56.117 | "cache-control": "max-age=15",
21:20:56.117 | "expires": "Thu, 23 Jan 2025 10:21:11 GMT",
21:20:56.117 | "vary": "Accept-Encoding",
21:20:56.117 | "server": "cloudflare",
21:20:56.117 | "cf-ray": "02e89599932-SEA",
21:20:56.117 | "content-encoding": "br"
21:20:56.117 | }
21:20:56.117 | }
21:20:56.117 | ---
21:20:56.117 |  
21:20:56.117 |  
21:20:56.149 | AG
21:20:56.149 |  
21:20:56.150 | HTTPError: Response code 403 (Forbidden)

my config is set to

      resolve: `gatsby-source-wordpress`,
      options: {
        url: process.env.GATSBY_GRAPHQL_API_URL,
        schema: {
          timeout: 6000, 
          requestConcurrency: 5
        },
        type: {
          MediaItem: {
            createFileNodes: false, 
          },
        },
      },
    },```

Any ideas on a workaround would be appreciated
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jan 24, 2025
@macphersonj
Copy link
Author

Anyone around?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer
Projects
None yet
Development

No branches or pull requests

1 participant