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

Unrecoverable error while generating Gatsby Image CDN fields crashes gatsby develop #37557

Closed
2 tasks done
tqureshi-uog opened this issue Jan 31, 2023 · 2 comments · Fixed by #37601
Closed
2 tasks done
Labels
good first issue Issue that doesn't require previous experience with Gatsby help wanted Issue with a clear description that the community can help with. topic: source-drupal Related to Gatsby's integration with Drupal topic: source-plugins Relates to the Gatsby source plugins (e.g. -filesystem) type: bug An issue or pull request relating to a bug in Gatsby

Comments

@tqureshi-uog
Copy link
Contributor

Preliminary Checks

Description

If you run gatsby develop it crashes and fails to build successfully whenever it runs into a problem with a random image:

reporter.panic(`[gatsby-source-drupal] Encountered an unrecoverable error while generating Gatsby Image CDN fields for url ${url}.

After I changed reporter.panic to reporter.warn (line 115 of gatsby-source-drupal/normalize.js) the gatsby develop command completed successfully and my local dev site worked. In other words, there's no legitimate reason for gatsby develop to fail outright simply because one image out of potentially thousands doesn't get its Image CDN fields generated.

Reproduction Link

n/a

Steps to Reproduce

Since there are any number of reasons outside a user's control for Image CDN field generation to fail, it would be difficult to deliberately reproduce this. It's most common on slower internet connections, however, so that would be a place to start - run gatsby develop in an environment with a slow internet connection.

Expected Result

gatsby develop should complete successfully.

Actual Result

gatsby develop fails and crashes with the following error message:

[gatsby-source-drupal] Encountered an unrecoverable error while generating Gatsby Image CDN fields for url
[image URL here - this is random and changes each time] See above for additional information.

If you manually edit normalize.js as I described above, you'll still see the error message, but gatsby develop will continue and eventually finish successfully.

Environment

System:
    OS: Linux 4.4 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
    npm: 9.4.0 - ~/.nvm/versions/node/v18.12.1/bin/npm
  npmPackages:
    gatsby: ^5.5.0 => 5.5.0
    gatsby-cli: ^5.5.0 => 5.5.0
    gatsby-plugin-asset-path: ^3.0.4 => 3.0.4
    gatsby-plugin-client-side-redirect: ^1.1.0 => 1.1.0
    gatsby-plugin-gatsby-cloud: ^5.5.0 => 5.5.0
    gatsby-plugin-google-analytics: ^5.5.0 => 5.5.0
    gatsby-plugin-google-tagmanager: ^5.5.0 => 5.5.0
    gatsby-plugin-image: ^3.5.0 => 3.5.0
    gatsby-plugin-manifest: ^5.5.0 => 5.5.0
    gatsby-plugin-react-helmet: ^6.5.0 => 6.5.0
    gatsby-plugin-robots-txt: ^1.8.0 => 1.8.0
    gatsby-plugin-root-import: ^2.0.9 => 2.0.9
    gatsby-plugin-sharp: ^5.5.0 => 5.5.0
    gatsby-plugin-styled-components: ^6.5.0 => 6.5.0
    gatsby-source-drupal: ^6.5.0 => 6.5.0
    gatsby-source-filesystem: ^5.5.0 => 5.5.0
    gatsby-source-wordpress: ^7.5.0 => 7.5.0
    gatsby-transformer-sharp: ^5.5.0 => 5.5.0
    gatsby-transformer-yaml: ^5.5.0 => 5.5.0
  npmGlobalPackages:
    gatsby-cli: 5.2.0

Config Flags

  resolve: `gatsby-source-drupal`,
    options: {
    baseUrl: process.env.DRUPAL_BASEURL,
    apiBase: process.env.DRUPAL_APIBASE,
    basicAuth: {
      username: process.env.BASIC_AUTH_USERNAME,
      password: process.env.BASIC_AUTH_PASSWORD,
    },
    fastBuilds: true,
    skipFileDownloads: true,
  },
@tqureshi-uog tqureshi-uog added the type: bug An issue or pull request relating to a bug in Gatsby label Jan 31, 2023
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jan 31, 2023
@LekoArts LekoArts added help wanted Issue with a clear description that the community can help with. good first issue Issue that doesn't require previous experience with Gatsby topic: source-drupal Related to Gatsby's integration with Drupal topic: source-plugins Relates to the Gatsby source plugins (e.g. -filesystem) and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Feb 1, 2023
@LekoArts
Copy link
Contributor

LekoArts commented Feb 1, 2023

Hi, thanks for the issue!

You're right that this shouldn't be panic. It should be panicOnBuild as it should still hard fail during gatsby build but error on gatsby develop.

To fix this, this line needs to use reporter.panicOnBuild:

reporter.panic(
`[gatsby-source-drupal] Encountered an unrecoverable error while generating Gatsby Image CDN fields for url ${url}. See above for additional information.`
)

Feel free to put up a PR fixing it!

tqureshi-uog added a commit to tqureshi-uog/gatsby that referenced this issue Feb 1, 2023
Fixes issue gatsbyjs#37557 so gatsby develop runs successfully even if Image CDN field generation fails for a particular image
@tqureshi-uog
Copy link
Contributor Author

Feel free to put up a PR fixing it!

Done: #37601 (not sure why some of the automated tests failed however).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Issue that doesn't require previous experience with Gatsby help wanted Issue with a clear description that the community can help with. topic: source-drupal Related to Gatsby's integration with Drupal topic: source-plugins Relates to the Gatsby source plugins (e.g. -filesystem) type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants