Home
Support Forums

Gatsby v4 and DSG doesn't work when deployed

Running into an error when deploying a Gatsby v4 site that uses DSG. DSG works fine when running locally or when using netlify dev.

Sample site: https://suspicious-minsky-7de6ab.netlify.app/
Sample repo: Viet Le / Dsg Test · GitLab

Steps to reproduce (if not cloning the above sample repo)

  1. Create new Gatsby project using the official blog starter (gatsby new dsg-test https://github.com/gatsbyjs/gatsby-starter-blog)
  2. Follow Netlify’s instructions regarding Gatsby v4 and DSG here: GitHub - netlify/netlify-plugin-gatsby: A build plugin to integrate Gatsby seamlessly with Netlify
  3. In gatsby-node.js, update the blog posts to use DSG (add: defer: true to the options passed into createPage)
  4. Deploy to Netlify
  5. Visit the home page and click into one of the blog entries.

You should see:

{“errorMessage”:“RequestId: 952d2102-13fe-4549-9f87-a10c0d2138ee Error: Runtime exited with error: exit status 7”,“errorType”:“Runtime.ExitError”}

Function log for __dsg:

6:35:59 PM: 2021-10-29T01:35:59.668Z undefined INFO directory already exists
6:36:02 PM: ERROR
6:36:02 PM: Uncaught Exception {“errorType”:“Error”,“errorMessage”:“Module did not
6:36:02 PM: self-register: ‘/var/task/.cache/query-engine/assets/prebuilds/linux-x64/node.ab
6:36:02 PM: i93.node’.”,“stack”:[“Error: Module did not self-register:
6:36:02 PM: ‘/var/task/.cache/query-engine/assets/prebuilds/linux-x64/node.abi93.node’.”,"
6:36:02 PM: at Object.Module._extensions…node (internal/modules/cjs/loader.js:1131:18)","
6:36:02 PM: at Module.load (internal/modules/cjs/loader.js:937:32)"," at
6:36:02 PM: Function.Module._load (internal/modules/cjs/loader.js:778:12)"," at
6:36:02 PM: Module.require (internal/modules/cjs/loader.js:961:19)"," at require
6:36:02 PM: (internal/modules/cjs/helpers.js:92:18)"," at Object.
6:36:02 PM: (/var/task/.cache/query-engine/index.js:194990:24)"," at webpack_require
6:36:02 PM: (/var/task/.cache/query-engine/index.js:451717:42)"," at Object.
6:36:02 PM: (/var/task/.cache/query-engine/index.js:194720:18)"," at webpack_require
6:36:02 PM: (/var/task/.cache/query-engine/index.js:451717:42)"," at
6:36:02 PM: /var/task/.cache/query-engine/index.js:451844:22"," at
6:36:02 PM: /var/task/.cache/query-engine/index.js:451984:3"," at Object.
6:36:02 PM: (/var/task/.cache/query-engine/index.js:451989:12)"," at Module._compile
6:36:02 PM: (internal/modules/cjs/loader.js:1072:14)"," at Object.Module._extensions…js
6:36:02 PM: (internal/modules/cjs/loader.js:1101:10)"," at Module.load
6:36:02 PM: (internal/modules/cjs/loader.js:937:32)"," at Function.Module._load
6:36:02 PM: (internal/modules/cjs/loader.js:778:12)"]}
6:36:02 PM: /var/task/.cache/query-engine/index.js:183402
6:36:02 PM: throw ex;
6:36:02 PM: ^
6:36:02 PM: Error: Module did not self-register: ‘/var/task/.cache/query-engine/assets/prebuilds/linux-x64/node.abi93.node’.
6:36:02 PM: at Object.Module._extensions…node (internal/modules/cjs/loader.js:1131:18)
6:36:02 PM: at Module.load (internal/modules/cjs/loader.js:937:32)
6:36:02 PM: at Function.Module._load (internal/modules/cjs/loader.js:778:12)
6:36:02 PM: at Module.require (internal/modules/cjs/loader.js:961:19)
6:36:02 PM: at require (internal/modules/cjs/helpers.js:92:18)
6:36:02 PM: at Object. (/var/task/.cache/query-engine/index.js:194990:24)
6:36:02 PM: at webpack_require (/var/task/.cache/query-engine/index.js:451717:42)
6:36:02 PM: at Object. (/var/task/.cache/query-engine/index.js:194720:18)
6:36:02 PM: at webpack_require (/var/task/.cache/query-engine/index.js:451717:42)
6:36:02 PM: at /var/task/.cache/query-engine/index.js:451844:22
6:36:02 PM: at /var/task/.cache/query-engine/index.js:451984:3
6:36:02 PM: at Object. (/var/task/.cache/query-engine/index.js:451989:12)
6:36:02 PM: at Module._compile (internal/modules/cjs/loader.js:1072:14)
6:36:02 PM: at Object.Module._extensions…js (internal/modules/cjs/loader.js:1101:10)
6:36:02 PM: at Module.load (internal/modules/cjs/loader.js:937:32)
6:36:02 PM: at Function.Module._load (internal/modules/cjs/loader.js:778:12)
6:36:02 PM: 952d2102 Duration: 2736.95 ms Memory Usage: 155 MB 6:36:02 PM: RequestId: 952d2102-13fe-4549-9f87-a10c0d2138ee Error: Runtime exited with error: exit status 7
Runtime.ExitError
6:36:02 PM: 2021-10-29T01:36:02.428Z undefined INFO directory already exists
6:36:03 PM: ERROR
6:36:03 PM: Uncaught Exception {“errorType”:“Error”,“errorMessage”:“Module did not
6:36:03 PM: self-register: ‘/var/task/.cache/query-engine/assets/prebuilds/linux-x64/node.ab
6:36:03 PM: i93.node’.”,“stack”:[“Error: Module did not self-register:
6:36:03 PM: ‘/var/task/.cache/query-engine/assets/prebuilds/linux-x64/node.abi93.node’.”,"
6:36:03 PM: at Object.Module._extensions…node (internal/modules/cjs/loader.js:1131:18)","
6:36:03 PM: at Module.load (internal/modules/cjs/loader.js:937:32)"," at
6:36:03 PM: Function.Module._load (internal/modules/cjs/loader.js:778:12)"," at
6:36:03 PM: Module.require (internal/modules/cjs/loader.js:961:19)"," at require
6:36:03 PM: (internal/modules/cjs/helpers.js:92:18)"," at Object.
6:36:03 PM: (/var/task/.cache/query-engine/index.js:194990:24)"," at webpack_require
6:36:03 PM: (/var/task/.cache/query-engine/index.js:451717:42)"," at Object.
6:36:03 PM: (/var/task/.cache/query-engine/index.js:194720:18)"," at webpack_require
6:36:03 PM: (/var/task/.cache/query-engine/index.js:451717:42)"," at
6:36:03 PM: /var/task/.cache/query-engine/index.js:451844:22"," at
6:36:03 PM: /var/task/.cache/query-engine/index.js:451984:3"," at Object.
6:36:03 PM: (/var/task/.cache/query-engine/index.js:451989:12)"," at Module._compile
6:36:03 PM: (internal/modules/cjs/loader.js:1072:14)"," at Object.Module._extensions…js
6:36:03 PM: (internal/modules/cjs/loader.js:1101:10)"," at Module.load
6:36:03 PM: (internal/modules/cjs/loader.js:937:32)"," at Function.Module._load
6:36:03 PM: (internal/modules/cjs/loader.js:778:12)"]}
6:36:03 PM: /var/task/.cache/query-engine/index.js:183402
6:36:03 PM: throw ex;
6:36:03 PM: ^
6:36:03 PM: Error: Module did not self-register: ‘/var/task/.cache/query-engine/assets/prebuilds/linux-x64/node.abi93.node’.
6:36:03 PM: at Object.Module._extensions…node (internal/modules/cjs/loader.js:1131:18)
6:36:03 PM: at Module.load (internal/modules/cjs/loader.js:937:32)
6:36:03 PM: at Function.Module._load (internal/modules/cjs/loader.js:778:12)
6:36:03 PM: at Module.require (internal/modules/cjs/loader.js:961:19)
6:36:03 PM: at require (internal/modules/cjs/helpers.js:92:18)
6:36:03 PM: at Object. (/var/task/.cache/query-engine/index.js:194990:24)
6:36:03 PM: at webpack_require (/var/task/.cache/query-engine/index.js:451717:42)
6:36:03 PM: at Object. (/var/task/.cache/query-engine/index.js:194720:18)
6:36:03 PM: at webpack_require (/var/task/.cache/query-engine/index.js:451717:42)
6:36:03 PM: at /var/task/.cache/query-engine/index.js:451844:22
6:36:03 PM: at /var/task/.cache/query-engine/index.js:451984:3
6:36:03 PM: at Object. (/var/task/.cache/query-engine/index.js:451989:12)
6:36:03 PM: at Module._compile (internal/modules/cjs/loader.js:1072:14)
6:36:03 PM: at Object.Module._extensions…js (internal/modules/cjs/loader.js:1101:10)
6:36:03 PM: at Module.load (internal/modules/cjs/loader.js:937:32)
6:36:03 PM: at Function.Module._load (internal/modules/cjs/loader.js:778:12)

Thanks for all the details! While we don’t want to derail anyone in the community who can help Viet out, assuming no such hero arrives in the next few days we’ll be talking with the author of our gatsby v4 support for his expert advice next week.

Hi!
That error can indicate a mismatch in node version between the built and deployed site. Can you try setting NODE_VERSION to 14 and doing a new build?

2 Likes

That did the trick. Thank you!

2 Likes