Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running yarn install + gatsby build. ERROR #11321 PLUGIN. Error while running the createPages lifecycle: Reducers may not dispatch actions. #25478

Closed
diegomadeit opened this issue Jul 2, 2020 · 17 comments
Assignees
Labels
type: bug An issue or pull request relating to a bug in Gatsby

Comments

@diegomadeit
Copy link

diegomadeit commented Jul 2, 2020

Description

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

Steps to reproduce

yarn workspace website gatsby build

Expected result

Build should finish running.

Actual result

Error on build process

Environment

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

@diegomadeit diegomadeit added the type: bug An issue or pull request relating to a bug in Gatsby label Jul 2, 2020
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jul 2, 2020
@diegomadeit diegomadeit changed the title Error running yarn install. ERROR #11321 PLUGIN. Error while running the createPages lifecycle: Reducers may not dispatch actions. Error running yarn install + gatsby build. ERROR #11321 PLUGIN. Error while running the createPages lifecycle: Reducers may not dispatch actions. Jul 2, 2020
@tombunn
Copy link

tombunn commented Jul 2, 2020

Having the same issue. Unable to build:

`
"gatsby-plugin-offline" threw an error while running the createPages lifecycle:

Reducers may not dispatch actions.
`

@pieh
Copy link
Contributor

pieh commented Jul 2, 2020

Investigating

@pieh pieh self-assigned this Jul 2, 2020
@pieh pieh removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jul 2, 2020
@pieh
Copy link
Contributor

pieh commented Jul 2, 2020

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?

@brysbra
Copy link

brysbra commented Jul 2, 2020

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  > selforder-ui@0.1.0 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! selforder-ui@0.1.0 build: `gatsby build`
15:40:44  npm ERR! Exit status 1
15:40:44  npm ERR! 
15:40:44  npm ERR! Failed at the selforder-ui@0.1.0 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

@diegomadeit
Copy link
Author

"resolutions": {
"xstate": "4.10.0"
}

resolutions added but I get the same error as before.

@t2ca
Copy link
Contributor

t2ca commented Jul 2, 2020

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.

@pieh
Copy link
Contributor

pieh commented Jul 2, 2020

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

@diegomadeit
Copy link
Author

@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?

@adamelliotfields
Copy link

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 xstate@4.10.0 is working for me to silence the warning.

For the first issue, npm install --save-exact gatsby-cli@2.12.55 worked for me (seems to be a bug in gatsby-cli@2.12.56).

@pieh
Copy link
Contributor

pieh commented Jul 2, 2020

I opened #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 xstate@4.11.0 and keep it on lower version (4.10.0 for example)

athomasoriginal added a commit to athomasoriginal/com.betweentwoparens that referenced this issue Jul 2, 2020
Resolved based on suggestion from this thread gatsbyjs/gatsby#25478
I honestly don't have the energy to continue digging deeper into this
and will chalk this up to the terrible that is the JS ecosystem
@pieh
Copy link
Contributor

pieh commented Jul 2, 2020

I just released gatsby@2.23.18 that should fix the issue

@vscncls
Copy link

vscncls commented Jul 2, 2020

gatsby@2.23.18 fixed the issue for me

@brysbra
Copy link

brysbra commented Jul 2, 2020

gatsby@2.23.18 fixed this for me as well. Great job guys and thanks a bunch!

athomasoriginal added a commit to athomasoriginal/com.betweentwoparens that referenced this issue Jul 2, 2020
Resolved based on suggestion from this thread gatsbyjs/gatsby#25478
I honestly don't have the energy to continue digging deeper into this
and will chalk this up to the terrible that is the JS ecosystem
athomasoriginal added a commit to athomasoriginal/com.betweentwoparens that referenced this issue Jul 2, 2020
Resolved based on suggestion from this thread gatsbyjs/gatsby#25478
I honestly don't have the energy to continue digging deeper into this
and will chalk this up to the terrible that is the JS ecosystem
athomasoriginal added a commit to athomasoriginal/com.betweentwoparens that referenced this issue Jul 2, 2020
Resolved based on suggestion from this thread gatsbyjs/gatsby#25478
I honestly don't have the energy to continue digging deeper into this
and will chalk this up to the terrible that is the JS ecosystem
athomasoriginal added a commit to athomasoriginal/com.betweentwoparens that referenced this issue Jul 2, 2020
Resolved based on suggestion from this thread gatsbyjs/gatsby#25478
I honestly don't have the energy to continue digging deeper into this
and will chalk this up to the terrible that is the JS ecosystem
@pablo67340
Copy link

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

@wardpeet
Copy link
Contributor

wardpeet commented Jul 2, 2020

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! 💜

@nugoo1
Copy link

nugoo1 commented Jul 3, 2020

Thank you guys! gatsby@2.23.18 fixed the issue for me as well

@diegomadeit
Copy link
Author

Thanks guys, well done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

10 participants