Since today 2nd July 16:00 CET when trying to run yarn install + gatsby build with gatsby 2.6.7 the following error is outputted. Codebase was not changed.
ERROR #11321 PLUGIN
"gatsby-theme-style-guide" threw an error while running the createPages lifecycle:
Reducers may not dispatch actions.
Error: Reducers may not dispatch actions.
redux.js:214 dispatch
[build_blog]/[redux]/lib/redux.js:214:13
index.js:67
[build_blog]/[gatsby]/dist/redux/index.js:67:88
index.js:14 Object.dispatch
[build_blog]/[redux-thunk]/lib/index.js:14:16
index.js:45 dispatch
[build_blog]/[gatsby-cli]/lib/reporter/redux/index.js:45:9
redux.js:483 Object.createLog
[build_blog]/[redux]/lib/redux.js:483:12
reporter.js:168 Reporter.warn
[build_blog]/[gatsby-cli]/lib/reporter/reporter.js:168:41
patch-console.js:22 Object.console.warn
[build_blog]/[gatsby-cli]/lib/reporter/patch-console.js:22:14
utils.js:449 Object.warn
[build_blog]/[xstate]/lib/utils.js:449:26
StateNode.js:1313
[build_blog]/[xstate]/lib/StateNode.js:1313:29
Array.map
StateNode.js:1311 StateNode.formatTransitions
[build_blog]/[xstate]/lib/StateNode.js:1311:18
StateNode.js:321 StateNode.get [as transitions]
[build_blog]/[xstate]/lib/StateNode.js:321:51
StateNode.js:296 StateNode.get [as on]
[build_blog]/[xstate]/lib/StateNode.js:296:36
StateNode.js:230
[build_blog]/[xstate]/lib/StateNode.js:230:93
Array.forEach
StateNode.js:230 StateNode._init
[build_blog]/[xstate]/lib/StateNode.js:230:45
failed createPages - 101.229s
yarn workspace website gatsby build
Build should finish running.
Error on build process
System:
OS: Linux 4.4 Alpine Linux
CPU: (4) x64 Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
Shell: 1.30.1 - /bin/ash
Binaries:
Node: 13.11.0 - /usr/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.2 - /usr/bin/npm
Languages:
Python: 2.7.18 - /usr/bin/python
npmGlobalPackages:
gatsby-cli: 2.12.56
Having the same issue. Unable to build:
`
"gatsby-plugin-offline" threw an error while running the createPages lifecycle:
Reducers may not dispatch actions.
`
Investigating
Ok, this seems related to recent release of xstate
package. Given that you use yarn
, as a workaround could you add:
"resolutions": {
"xstate": "4.10.0"
}
to your package.json file, rerun yarn install
and try again?
Edited after seeing @pieh comment, we're using npm.
Experiencing the same issue when building.
15:40:38 Step 8/16 : RUN npm run build
15:40:38 ---> Running in 900512a89297
15:40:38
15:40:38 > [email protected] build /usr/src/app
15:40:38 > gatsby build
15:40:38
15:40:38 โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
15:40:38 โ โ
15:40:38 โ Gatsby collects anonymous usage analytics โ
15:40:38 โ to help improve Gatsby for all users. โ
15:40:38 โ โ
15:40:38 โ If you'd like to opt-out, you can use `gatsby telemetry --disable` โ
15:40:38 โ To learn more, checkout https://gatsby.dev/telemetry โ
15:40:38 โ โ
15:40:38 โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
15:40:42 success open and validate gatsby-configs - 0.055s
15:40:43 success load plugins - 0.525s
15:40:43 success onPreInit - 0.004s
15:40:43 success delete html and css files from previous builds - 0.022s
15:40:43 success initialize cache - 0.014s
15:40:43 success copy gatsby files - 0.046s
15:40:44 success onPreBootstrap - 1.043s
15:40:44 success createSchemaCustomization - 0.021s
15:40:44 success source and transform nodes - 0.071s
15:40:44 success building schema - 0.415s
15:40:44 success createPages - 0.001s
15:40:44
15:40:44 ERROR
15:40:44
15:40:44 UNHANDLED REJECTION Reducers may not dispatch actions.
15:40:44
15:40:44
15:40:44
15:40:44 Error: Reducers may not dispatch actions.
15:40:44
15:40:44 - redux.js:214 dispatch
15:40:44 [app]/[redux]/lib/redux.js:214:13
15:40:44
15:40:44 - index.js:67
15:40:44 [app]/[gatsby]/dist/redux/index.js:67:88
15:40:44
15:40:44 - index.js:14 Object.dispatch
15:40:44 [app]/[redux-thunk]/lib/index.js:14:16
15:40:44
15:40:44 - index.js:45 dispatch
15:40:44 [app]/[gatsby]/[gatsby-cli]/lib/reporter/redux/index.js:45:9
15:40:44
15:40:44 - redux.js:483 Object.createLog
15:40:44 [app]/[redux]/lib/redux.js:483:12
15:40:44
15:40:44 - reporter.js:168 Reporter.warn
15:40:44 [app]/[gatsby]/[gatsby-cli]/lib/reporter/reporter.js:168:41
15:40:44
15:40:44 - patch-console.js:22 Object.console.warn
15:40:44 [app]/[gatsby]/[gatsby-cli]/lib/reporter/patch-console.js:22:14
15:40:44
15:40:44 - utils.js:449 Object.warn
15:40:44 [app]/[xstate]/lib/utils.js:449:26
15:40:44
15:40:44 - StateNode.js:1313
15:40:44 [app]/[xstate]/lib/StateNode.js:1313:29
15:40:44
15:40:44 - Array.map
15:40:44
15:40:44 - StateNode.js:1311 StateNode.formatTransitions
15:40:44 [app]/[xstate]/lib/StateNode.js:1311:18
15:40:44
15:40:44 - StateNode.js:321 StateNode.get [as transitions]
15:40:44 [app]/[xstate]/lib/StateNode.js:321:51
15:40:44
15:40:44 - StateNode.js:296 StateNode.get [as on]
15:40:44 [app]/[xstate]/lib/StateNode.js:296:36
15:40:44
15:40:44 - StateNode.js:230
15:40:44 [app]/[xstate]/lib/StateNode.js:230:93
15:40:44
15:40:44 - Array.forEach
15:40:44
15:40:44 - StateNode.js:230 StateNode._init
15:40:44 [app]/[xstate]/lib/StateNode.js:230:45
15:40:44
15:40:44
15:40:44 not finished createPagesStatefully - 0.158s
15:40:44 npm ERR! code ELIFECYCLE
15:40:44 npm ERR! errno 1
15:40:44 npm ERR! [email protected] build: `gatsby build`
15:40:44 npm ERR! Exit status 1
15:40:44 npm ERR!
15:40:44 npm ERR! Failed at the [email protected] build script.
15:40:44 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
15:40:44
15:40:44 npm ERR! A complete log of this run can be found in:
15:40:44 npm ERR! /root/.npm/_logs/2020-07-02T15_40_44_800Z-debug.log
15:40:45 The command '/bin/sh -c npm run build' returned a non-zero code: 1
"resolutions": {
"xstate": "4.10.0"
}
resolutions added but I get the same error as before.
Im having the same issue in projects that use a theme.
error "gatsby-theme-blog-core" threw an error while running the createPages lifecycle: Reducers may not dispatch actions.
However i'm only having this issue on Netlify and not locally.
Also I started to see this warning during build:
warn Warning: Empty string transition configs (e.g.,
{ on: { '': ... }}) for transient transitions are deprecated.
Yeah, xstate
added deprecation warnings in 4.11, which in some cases cause the "Reducers may not dispatch actions." weird errors. That's why I thought resolution would help :/
For those cases - if you run gatsby build
locally it runs fine, but if you would run npm run build
/ yarn build
you would likely see same error. This also could explain why it fails on netlify if you use npm
/yarn
command there
@t2ca In my project I'm also using a theme. Similar to you in my case the error is in the pipeline but locally builds good.
I added the resolutions manually, I'm having issues setting resolution in a workspace, any suggestions?
Yeah, I deleted my comment after I realized I wrote almost exactly what you did (great minds), but for what it's worth, npm install --save-exact [email protected]
is working for me to silence the warning.
For the first issue, npm install --save-exact [email protected]
worked for me (seems to be a bug in [email protected]
).
I opened https://github.com/gatsbyjs/gatsby/pull/25483 to adjust xstate code, but we can't fix older releases, those will need to rely on yarn resolutions
or npm install --save-exact
tricks to not install [email protected]
and keep it on lower version (4.10.0 for example)
I just released [email protected]
that should fix the issue
[email protected]
fixed the issue for me
[email protected]
fixed this for me as well. Great job guys and thanks a bunch!
Nothing more satisfying than googling a problem that you've never had before only to find a GH issue created hours before you looked. Working for me too, thanks so much everybody who maintains this project! <3
Thank you for opening this,
We're marking this issue as answered and closing it for now but please feel free to reopen this and comment if you would like to continue this discussion. We hope we managed to help and thank you for using Gatsby! ๐
Thank you guys! [email protected] fixed the issue for me as well
Thanks guys, well done!
Most helpful comment
I just released
[email protected]
that should fix the issue