gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.13k stars 10.33k forks source link

Gatsby build fails with non-descript ENGINE.VALIDATION Error #38467

Open danyim opened 10 months ago

danyim commented 10 months ago

Preliminary Checks

Description

Hello,

I am in the process of bringing my Gatsby v3 site up to v5, and unfortunately I am running into some issues when executing gatsby build. After a gatsby clean and gatsby build --verbose, I receive the following nondescript error:

failed Validating Rendering Engines - 3.372s

 ERROR #98001  ENGINE.VALIDATION

Built Rendering Engines failed validation.

Please open an issue with a reproduction at https://gatsby.dev/new-issue for more help.

  Error: Worker exited before finishing task
  - index.js:205 ChildProcess.<anonymous>
    [daniely.im-gatsby]/[gatsby-worker]/dist/index.js:205:41

not finished Running gatsby.IMAGE_CDN jobs - 75.170s

My repo works without issue when running gatsby develop.

Reproduction Link

(In progress)

Steps to Reproduce

  1. gatsby build --verbose
  2. See error

Expected Result

I expected a successful build

Actual Result

Build fails with ERROR #98001 ENGINE.VALIDATION

Environment

System:
    OS: macOS 12.6.3
    CPU: (8) x64 Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node
    Yarn: 1.22.5 - ~/.yarn/bin/yarn
    npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm
  Browsers:
    Chrome: 116.0.5845.96
    Firefox: 115.0.2
    Safari: 15.6.1
  npmPackages:
    gatsby: ^5.11.0 => 5.11.0 
    gatsby-core-utils: ^4.11.0 => 4.11.0 
    gatsby-image: ^3.1.0 => 3.1.0 
    gatsby-plugin-fontawesome-css: ^1.2.0 => 1.2.0 
    gatsby-plugin-gtag: ^1.0.13 => 1.0.13 
    gatsby-plugin-offline: ^6.11.0 => 6.11.0 
    gatsby-plugin-postcss: ^6.11.0 => 6.11.0 
    gatsby-plugin-react-helmet: ^6.11.0 => 6.11.0 
    gatsby-plugin-react-svg: ^3.3.0 => 3.3.0 
    gatsby-plugin-sharp: ^5.11.0 => 5.11.0 
    gatsby-plugin-sitemap: ^6.11.0 => 6.11.0 
    gatsby-plugin-styled-components: ^6.11.0 => 6.11.0 
    gatsby-plugin-typescript: ^5.11.0 => 5.11.0 
    gatsby-plugin-web-font-loader: ^1.0.4 => 1.0.4 
    gatsby-source-filesystem: ^5.11.0 => 5.11.0 
    gatsby-source-wordpress: ^7.11.0 => 7.11.0 
    gatsby-transformer-sharp: ^5.11.0 => 5.11.0 
  npmGlobalPackages:
    gatsby-core-utils: 4.8.0
    gatsby: 5.8.0

Config Flags

None

danyim commented 10 months ago

This issue appears to be similar to #38465, which does not have a resolution

gustavo-a commented 10 months ago

Same error. It seems like an issue with gatsby-source-wordpress since it disappeared after I downgraded it to version 6.25.4

danyim commented 10 months ago

@gustavo-a Thanks for the tip! That worked!

To anyone else who needs to be unblocked, I was able to get my site building with the following deps:

  System:
    OS: macOS 12.6.3
    CPU: (8) x64 Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node
    Yarn: 1.22.5 - ~/.yarn/bin/yarn
    npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm
  Browsers:
    Chrome: 116.0.5845.96
    Firefox: 116.0.2
    Safari: 15.6.1
  npmPackages:
    gatsby: ^5.11.0 => 5.11.0 
    gatsby-core-utils: ^4.11.0 => 4.11.0 
    gatsby-image: ^3.1.0 => 3.11.0 
    gatsby-plugin-fontawesome-css: ^1.2.0 => 1.2.0 
    gatsby-plugin-gtag: ^1.0.13 => 1.0.13 
    gatsby-plugin-image: ^3.11.0 => 3.11.0 
    gatsby-plugin-offline: ^6.11.0 => 6.11.0 
    gatsby-plugin-postcss: ^6.11.0 => 6.11.0 
    gatsby-plugin-react-helmet: ^6.11.0 => 6.11.0 
    gatsby-plugin-react-svg: ^3.3.0 => 3.3.0 
    gatsby-plugin-sharp: ^5.11.0 => 5.11.0 
    gatsby-plugin-sitemap: ^6.11.0 => 6.11.0 
    gatsby-plugin-styled-components: ^6.11.0 => 6.11.0 
    gatsby-plugin-typescript: ^5.11.0 => 5.11.0 
    gatsby-plugin-web-font-loader: ^1.0.4 => 1.0.4 
    gatsby-source-filesystem: ^5.11.0 => 5.11.0 
    gatsby-source-wordpress: ^6.25.4 => 6.25.5 
    gatsby-transformer-sharp: ^5.11.0 => 5.11.0 
  npmGlobalPackages:
    gatsby-core-utils: 4.8.0
    gatsby: 5.8.0
insaurabh commented 10 months ago

I am also getting this error

image

It was working fine earlier, i started implementing , and development works fine but the build fails.

  1. I deleted the node_module folder
  2. Deleted package-lock.json
  3. Using node 18.15.0

    "gatsby-source-wordpress": "^7.6.0"

Still, the problem is the same, reverted the slice work, but no luck.

insaurabh commented 10 months ago

6.25.4

Tried with "gatsby-source-wordpress": "7.11.0", still same issue.

insaurabh commented 10 months ago

I am also getting this error

image

It was working fine earlier, i started implementing , and development works fine but the build fails.

  1. I deleted the node_module folder
  2. Deleted package-lock.json
  3. Using node 18.15.0

"gatsby-source-wordpress": "^7.6.0"

Still, the problem is the same, reverted the slice work, but no luck.

image

After deleting the package-lock.json and reinstalling the modules, now i am getting this error as well, DB source is same, nod modification done in CMS.

insaurabh commented 10 months ago

I am also getting this error

image

It was working fine earlier, i started implementing , and development works fine but the build fails.

  1. I deleted the node_module folder
  2. Deleted package-lock.json
  3. Using node 18.15.0

"gatsby-source-wordpress": "^7.6.0"

Still, the problem is the same, reverted the slice work, but no luck.

In my case after investing days, I found the at getServerData which i am using in pages folder causing the issue. When I removed this method, a build was created. Now i am trying to debug the issue with this method as same method working on other 4 projects, which i created.


export async function getServerData() {
    try {
        // const res = await fetchFavorite();
        return {
            status: 200,
            props: {
                data: "Server data",
            },
        }
    } catch (error) {
        return {
            status: 500,
            headers: {},
            props: {},
        }
    }
}```
CloudBop commented 10 months ago

In the case of my error https://github.com/gatsbyjs/gatsby/issues/38465 the error seems very closely linked to the reasons I explain in my reply.

CloudBop commented 10 months ago

@insaurabh Interesting how you've come across this error on SSR, thanks for pointing that out. I've noticed the same happening on another of my websites.

CloudBop commented 10 months ago

@insaurabh @danyim @gustavo-a

I've rolled back to 7.9.0 and this seems to fix both the current issue and also the https://github.com/gatsbyjs/gatsby/issues/38465

insaurabh commented 10 months ago

@insaurabh @danyim @gustavo-a

I've rolled back to 7.9.0 and this seems to fix both the current issue and also the #38465

Hi @CloudBop

7.9.0 worked for me as well. I rolled back to this version and tested my site, every thing seems fine. I tried the latest version as well but it was not working, same error was thrown.

Thank you.

reseau-map commented 4 months ago

Hi !

I have the same issue while upgrading from 4 to 5. Gatsby develop works, build throws the same error. I downgraded "gatsby-source-wordpress" to 6.25.5 and it works. 7.9.0 did not work for me. I had to override some peer dependencies like that :

"overrides": {
    "gatsby-source-wordpress": {
      "gatsby": "^5.13.3",
      "gatsby-plugin-image": "^3.13.1",
      "gatsby-plugin-sharp": "^5.13.1",
      "gatsby-transformer-sharp": "^5.13.1"
    }
  },

Thanks

Mellis84 commented 3 months ago

@insaurabh @danyim @gustavo-a I've rolled back to 7.9.0 and this seems to fix both the current issue and also the #38465

Hi @CloudBop

7.9.0 worked for me as well. I rolled back to this version and tested my site, every thing seems fine. I tried the latest version as well but it was not working, same error was thrown.

Thank you.

Hey @insaurabh, did you end up getting builds working when using getServerData() ? that seems to be the catalyst for me and I'm pretty desperate for a solution as I need this for Wordpress preview pages.

Mellis84 commented 3 months ago

When flipping the silent bool on the validateEngines function inside Gatsby's validate-engines util to false, the build fail log outputs:

Error: [Immer] minified error nr: 18 'MapSet'. Find the full error at: https://bit.ly/3cXEKWf
Encountered a critical error when running the checkIfSchemaHasChanged build step
vipinamethi commented 1 month ago

I am getting this error now usnig 7.9.0 with node 18.15.0

image

insaurabh commented 1 month ago

@insaurabh @danyim @gustavo-a I've rolled back to 7.9.0 and this seems to fix both the current issue and also the #38465

Hi @CloudBop 7.9.0 worked for me as well. I rolled back to this version and tested my site, every thing seems fine. I tried the latest version as well but it was not working, same error was thrown. Thank you.

Hey @insaurabh, did you end up getting builds working when using getServerData() ? that seems to be the catalyst for me and I'm pretty desperate for a solution as I need this for Wordpress preview pages.

For that project getServerData() working when rolled back.

Mellis84 commented 1 month ago

It's so weirdly inconsistent. Sometimes if I remove my node_modules folder and .lock, start a fresh install, it complains with the validation engine error, so i uninstall gatsby-source-wordpress, reinstall to 7.10.1 it works (sometimes). When investigating the validation error more closely (by going into node_modules > gatsby > dist > utils > validate-engines > index.js and setting silent to false ) it looked like the errors were stemming from immer, more precisely @rematch/immer.

Because some other plugins i have like react-redux, were using different versions of immer i had to set some overrides for gatsby-source-wordpress in my package.json

  "overrides": {
    "gatsby-source-wordpress": {
      "@rematch/immer": "1.2.0",
      "immer": "9.0.21"
    }
  }

This fixed it for me but i still can't add certain options in the gatsby-config for gatsby-source-wordpress like presets etc.... such a headache.

Mellis84 commented 1 month ago

I am getting this error now usnig 7.9.0 with node 18.15.0

image

@vipinamethi try my approach above:

rm -rf node_modules rm -rf package-lock.json

add "gatsby-source-wordpress": "^7.10.1" to your dependencies

then add

 "overrides": {
    "gatsby-source-wordpress": {
      "@rematch/immer": "1.2.0",
      "immer": "9.0.21"
    }
  }

to your package.json, then npm install.

g-aubert commented 1 week ago

Hello I have the same issue :
bringing my Gatsby v2 site up to v5 gatsby develop is fine

ERROR #98001 ENGINE.VALIDATION

__nccwpck_require__ is not define /opt/soft/io-gatsby5/.cache/query-engine/index.js

apparently it's a problem with wepack