netlify / netlify-plugin-gatsby

A build plugin to integrate Gatsby seamlessly with Netlify
https://www.npmjs.com/package/@netlify/plugin-gatsby
MIT License
92 stars 18 forks source link

Error "Module did not self-register" in SSR pages after upgrading to 4.8.0 #294

Closed ascorbic closed 2 years ago

ascorbic commented 2 years ago

Yes the site does build however SSR stopped working and I thought maybe this was related.

Now, I'm getting this message when I visit a page with SSR.

{
"errorType": "Error",
"errorMessage": "Module did not self-register: '/var/task/.cache/query-engine/assets/prebuilds/linux-x64/node.abi93.glibc.node'.",
"trace": [
"Error: Module did not self-register: '/var/task/.cache/query-engine/assets/prebuilds/linux-x64/node.abi93.glibc.node'.",
"    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1144:18)",
"    at Module.load (internal/modules/cjs/loader.js:950:32)",
"    at Function.Module._load (internal/modules/cjs/loader.js:790:12)",
"    at Module.require (internal/modules/cjs/loader.js:974:19)",
"    at require (internal/modules/cjs/helpers.js:93:18)",
"    at Object.exports.__esModule (/var/task/.cache/query-engine/index.js:146728:18)",
"    at __webpack_require__ (/var/task/.cache/query-engine/index.js:682628:42)",
"    at Object.<anonymous> (/var/task/.cache/query-engine/index.js:146682:20)",
"    at __webpack_require__ (/var/task/.cache/query-engine/index.js:682628:42)",
"    at Object.defineProperty.value (/var/task/.cache/query-engine/index.js:144176:13)"
]
}

It was working before upgrading Gatsby to v4.8 and it works locally.

Originally posted by @t2ca in https://github.com/netlify/netlify-plugin-gatsby/issues/291#issuecomment-1049005132

ascorbic commented 2 years ago

@t2ca I'm having some difficulty reproducing this. Could you share your full build logs please?

t2ca commented 2 years ago

Hey @ascorbic

I pinned gatsby to v4.7.0

And you can see SSR working here again: https://www.t2.ca/test-ssr/

I'm pretty sure that this issue is related to changes in v4.8.0

igneosaur commented 2 years ago

I'm also experiencing this issue that's only happened after an upgrade from @netlify/plugin-gatsby@^2.0.3 and gatsby@^4.7.1 to latest 2.1.2 and 4.9.3 respectively.

ascorbic commented 2 years ago

Does anyone have a public repo that they can share, as I wasn't able to reproduce this myself

dcheepurupalli commented 2 years ago

I'm also facing this issue. So I cloned the Gatsby SSR starter to reproduce it. Below is the repo and

https://github.com/dcheepurupalli/gatsby-starter-rendering-modes Netlify URL - https://reverent-johnson-e551da.netlify.app/ssr

In my private project, getting Gatsby SSR page as 404 after deployment Netlify. But in local it's working fine.

ascorbic commented 2 years ago

Thanks!

t2ca commented 2 years ago

I'm now getting a slightly different error with this update.

{
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module '/var/task/.cache/query-engine/assets/prebuilds/linux-x64/node.abi83.glibc.node'\nRequire stack:\n- /var/task/.cache/query-engine/index.js\n- /var/task/.netlify/functions-internal/__ssr/__ssr.js\n- /var/task/__ssr.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
"trace": [
"Runtime.ImportModuleError: Error: Cannot find module '/var/task/.cache/query-engine/assets/prebuilds/linux-x64/node.abi83.glibc.node'",
"Require stack:",
"- /var/task/.cache/query-engine/index.js",
"- /var/task/.netlify/functions-internal/__ssr/__ssr.js",
"- /var/task/__ssr.js",
"- /var/runtime/UserFunction.js",
"- /var/runtime/index.js",
"    at _loadUserApp (/var/runtime/UserFunction.js:202:13)",
"    at Object.module.exports.load (/var/runtime/UserFunction.js:242:17)",
"    at Object.<anonymous> (/var/runtime/index.js:43:30)",
"    at Module._compile (internal/modules/cjs/loader.js:1085:14)",
"    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)",
"    at Module.load (internal/modules/cjs/loader.js:950:32)",
"    at Function.Module._load (internal/modules/cjs/loader.js:790:12)",
"    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)",
"    at internal/main/run_main_module.js:17:47"
]
}
ascorbic commented 2 years ago

@t2ca can you share a link to the deploy

t2ca commented 2 years ago

@t2ca can you share a link to the deploy

Yes, of course.

https://app.netlify.com/sites/t2ca/deploys/62320154e06f50233a4c5dd3

t2ca commented 2 years ago

It's working. Thank you @ascorbic

MANTENN commented 2 years ago

I installed gatsby netlfity essentials plugin and I am getting the same error as t2ca.

  "dependencies": {
    "@headlessui/react": "^1.4.3",
    "@heroicons/react": "^1.0.5",
    "@netlify/plugin-gatsby": "^3.3.1",
    "@tailwindcss/aspect-ratio": "^0.4.0",
    "@tailwindcss/forms": "^0.4.0",
    "@tailwindcss/typography": "^0.5.0",
    "actionsheet-react": "^1.0.14",
    "axios": "^0.27.2",
    "codemirror": "^5.63.3",
    "dotenv": "^8.6.0",
    "easymde": "^2.15.0",
    "fecha": "^4.2.1",
    "gatsby": "^4.2.0",
    "gatsby-image": "^3.11.0",
    "gatsby-plugin-force-trailing-slashes": "^1.0.5",
    "gatsby-plugin-google-fonts": "^1.0.1",
    "gatsby-plugin-google-tagmanager": "^4.2.0",
    "gatsby-plugin-image": "^2.2.0",
    "gatsby-plugin-netlify": "^5.0.0",
    "gatsby-plugin-nprogress": "^4.5.0",
    "gatsby-plugin-react-helmet": "^5.2.0",
    "gatsby-plugin-react-helmet-canonical-urls": "^1.4.0",
    "gatsby-plugin-robots-txt": "^1.6.14",
    "gatsby-plugin-sharp": "^4.2.0",
    "gatsby-plugin-sitemap": "3.3",
    "gatsby-source-filesystem": "^4.2.0",
    "gatsby-source-strapi": "^1.0.2",
    "gatsby-transformer-sharp": "^4.2.0",
    "jotai": "^1.6.0",
    "jwt-decode": "^3.1.2",
    "lodash-move": "^1.1.1",
    "lodash.clamp": "^4.0.3",
    "lodash.debounce": "^4.0.8",
    "node-fetch": "^2.6.7",
    "react": "^17.0.1",
    "react-beautiful-dnd": "^13.1.0",
    "react-dom": "^17.0.1",
    "react-feather": "^2.0.10",
    "react-helmet": "^6.1.0",
    "react-hook-form": "^7.20.4",
    "react-loadable": "^5.5.0",
    "react-markdown": "^7.1.0",
    "react-quill": "^2.0.0-beta.4",
    "react-share": "^4.4.0",
    "react-simplemde-editor": "^5.0.2",
    "react-spring": "^9.4.5",
    "react-spring-bottom-sheet": "^3.4.0",
    "react-textarea-autosize": "^8.3.3",
    "react-use-gesture": "^9.1.3",
    "remark-gfm": "^3.0.1"
  },
  "devDependencies": {
    "autoprefixer": "^10.3.4",
    "gatsby-plugin-postcss": "^4.14.0",
    "postcss": "^8.3.6",
    "tailwindcss": "^3.0.7"
  }

I've been searching for it the past two days—I can't find anything on Google related to the error, so I used GitHub search

MANTENN commented 2 years ago

Fixed it up upgrading gatsby to latest—gatsby lame doesn't include a table of where it works and doesn't.