Reputation: 125
I have finished working on my gatsby project, but I have problem when trying to build. I got this #95313 error. I do not have any errors in project.
ERROR
Page data from page-data.json for the failed page "/success/": {
"componentChunkName": "component---src-pages-success-index-tsx",
"path": "/success/",
"result": {
"pageContext": {}
},
"staticQueryHashes": []
}
failed Building static HTML for pages - 1.268s
ERROR #95313
Building static HTML failed for path "/success/"
See our docs page for more info on this error: https://gatsby.dev/debug-html
WebpackError: TypeError: Cannot read property 'store' of null
- useSelector.js:126
[my-gatsby-site]/[react-redux]/es/hooks/useSelector.js:126:1
- index.tsx:13
webpack:/my-gatsby-site/src/pages/success/index.tsx:13:42
- static-entry.js:286
webpack:/my-gatsby-site/.cache/static-entry.js:286:22
- stylis.esm.js:74
[my-gatsby-site]/[@emotion]/stylis/dist/stylis.esm.js:74:1
How can I resolve it? Thank you for your help.
Upvotes: 2
Views: 2216
Reputation: 29316
I guess the problem is that you are using wrapRootElement
wrapper in your gatsby-browser.js
while you need also to use it in the gatsby-ssr.js
because it's a shared API.
Note: There is an equivalent hook in Gatsby’s SSR API. It is recommended to use both APIs together. For example usage, check out Using redux.
I've made a PR that should fix it: https://github.com/Dovtutis/playEverywhere/compare/main...fbuireu:patch-1
Upvotes: 4