{"action":"created","issue":{"url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/6362","repository_url":"https://api.github.com/repos/gatsbyjs/gatsby","labels_url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/6362/labels{/name}","comments_url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/6362/comments","events_url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/6362/events","html_url":"https://github.com/gatsbyjs/gatsby/issues/6362","id":339759413,"node_id":"MDU6SXNzdWUzMzk3NTk0MTM=","number":6362,"title":"[v2] Cannot build for production when using Redux","user":{"login":"pippo111","id":22401020,"node_id":"MDQ6VXNlcjIyNDAxMDIw","avatar_url":"https://avatars1.githubusercontent.com/u/22401020?v=4","gravatar_id":"","url":"https://api.github.com/users/pippo111","html_url":"https://github.com/pippo111","followers_url":"https://api.github.com/users/pippo111/followers","following_url":"https://api.github.com/users/pippo111/following{/other_user}","gists_url":"https://api.github.com/users/pippo111/gists{/gist_id}","starred_url":"https://api.github.com/users/pippo111/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pippo111/subscriptions","organizations_url":"https://api.github.com/users/pippo111/orgs","repos_url":"https://api.github.com/users/pippo111/repos","events_url":"https://api.github.com/users/pippo111/events{/privacy}","received_events_url":"https://api.github.com/users/pippo111/received_events","type":"User","site_admin":false},"labels":[{"id":214544677,"node_id":"MDU6TGFiZWwyMTQ1NDQ2Nzc=","url":"https://api.github.com/repos/gatsbyjs/gatsby/labels/%F0%9F%8F%B7%20type:%20question%20or%20discussion","name":"🏷 type: question or discussion","color":"d4c5f9","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-10T09:19:23Z","updated_at":"2018-07-12T10:45:35Z","closed_at":null,"author_association":"NONE","body":"<!--\r\n  To make it easier for us to help you — please follow the suggested format below.\r\n\r\n  Useful Links:\r\n  - Documentation: https://www.gatsbyjs.org/docs/\r\n  - How to File an Issue: https://www.gatsbyjs.org/docs/how-to-file-an-issue/\r\n\r\n  Before opening a new issue, please search existing issues https://github.com/gatsbyjs/gatsby/issues\r\n-->\r\n\r\n## Description\r\n\r\nWhen I'm trying to build for production an error occurs:\r\n` WebpackError: Invariant Violation: Could not find \"store\" in either the context or props of \"Connect(FiltersPage)\".   Either wrap the root component in a <Provider>, or explicitly pass \"store\" as a prop to \"Connect(FiltersPage)\".`\r\n\r\n### Steps to reproduce\r\nComponent with connected Redux:\r\n```import React, { Component } from 'react'\r\nimport { connect } from 'react-redux'\r\nimport { graphql } from 'gatsby'\r\n\r\nimport Layout from '../components/Layouts/filters'\r\nimport { arrayCombineUnique, extractNode, parseQueryFilters } from '../utils/helpers'\r\nimport { filtersActions } from '../components/Filters/state'\r\nimport ItemGroups from '../components/Items/ItemGroups'\r\n\r\nclass FiltersPage extends Component {\r\n  componentDidMount () {\r\n    const { setFilters, pageContext, data } = this.props\r\n\r\n    const hotelsCategories = extractNode(data.allFirestoreHotel, 'categories')\r\n    const allHotelsUniqueCategories = arrayCombineUnique(hotelsCategories)\r\n\r\n    const toursCategories = extractNode(data.allFirestoreTour, 'categories')\r\n    const allToursUniqueCategories = arrayCombineUnique(toursCategories)\r\n\r\n    setFilters(parseQueryFilters(this.props.location.search))\r\n    setFilters({ ...pageContext.filters, allHotelCategories: allHotelsUniqueCategories, allTourCategories: allToursUniqueCategories })\r\n  }\r\n\r\n  render () {\r\n    const { data } = this.props\r\n\r\n    return (\r\n      <Layout>\r\n        <ItemGroups data={data} />\r\n      </Layout>\r\n    )\r\n  }\r\n}\r\n\r\n/**************************************************************\r\n * REDUX\r\n **************************************************************/\r\n\r\nconst mapDispatchTopProps = {\r\n  setFilters: filtersActions.setFilters\r\n}\r\n\r\nexport default connect(null, mapDispatchTopProps)(FiltersPage)\r\n\r\n/**************************************************************\r\n * GRAPHQL\r\n **************************************************************/\r\nexport const pageQuery = graphql`\r\n  query FiltersPage($country: String!) {\r\n    allFirestoreTour(filter: { country: { eq: $country } }) {\r\n      edges {\r\n        node {\r\n          id\r\n          title\r\n          country\r\n          location\r\n          region\r\n          intro\r\n          categories\r\n          days\r\n          collection\r\n          coverImage\r\n          fields {\r\n            slug\r\n            countrySlug\r\n          }\r\n        }\r\n      }\r\n    }\r\n    allFirestoreTrip(filter: { country: { eq: $country } }) {\r\n      edges {\r\n        node {\r\n          id\r\n          title\r\n          country\r\n          location\r\n          region\r\n          intro\r\n          collection\r\n          coverImage\r\n          fields {\r\n            slug\r\n            countrySlug\r\n          }\r\n        }\r\n      }\r\n    }\r\n    allFirestoreHotel(filter: { country: { eq: $country } }) {\r\n      edges {\r\n        node {\r\n          id\r\n          title\r\n          country\r\n          location\r\n          region\r\n          intro\r\n          categories\r\n          coverImage\r\n          stars\r\n          collection\r\n          fields {\r\n            slug\r\n            countrySlug\r\n          }\r\n        }\r\n      }\r\n    }\r\n  }\r\n`\r\n```\r\n\r\nUsual gatsby build command:\r\n`node --max_old_space_size=8196 ./node_modules/.bin/gatsby build`\r\n\r\n### Expected result\r\n\r\nCompilation should be successful as it was in v1\r\n\r\n### Actual result\r\n\r\nFull build log:\r\n```success open and validate gatsby-config — 0.008 s\r\nsuccess onPreBootstrap — 0.133 s\r\nsuccess delete html and css files from previous builds — 6.535 s\r\nsuccess copy gatsby files — 0.013 s\r\n⢀ source and transform nodes -> wordpress__POST fetched : 1\r\n⡀ source and transform nodes -> wordpress__PAGE fetched : 6\r\n⠁ source and transform nodes -> wordpress__wp_media fetched : 15\r\n⠠ source and transform nodes -> wordpress__wp_blocks fetched : 0\r\n⠄ source and transform nodes -> wordpress__wp_jp_pay_order fetched : 0\r\n⠈ source and transform nodes -> wordpress__wp_jp_pay_product fetched : 0\r\n⢀ source and transform nodes -> wordpress__wp_feedback fetched : 0\r\n⠂ source and transform nodes -> wordpress__wp_types fetched : 1\r\n⠐ source and transform nodes -> wordpress__wp_statuses fetched : 1\r\n⡀ source and transform nodes -> wordpress__wp_taxonomies fetched : 1\r\n⠁ source and transform nodes -> wordpress__CATEGORY fetched : 4\r\n⠠ source and transform nodes -> wordpress__TAG fetched : 1\r\n⠄ source and transform nodes -> wordpress__wp_users fetched : 3\r\n⠈ source and transform nodes -> wordpress__wp_me fetched : 1\r\n⢀ source and transform nodes -> wordpress__wp_comments fetched : 0\r\n⠂ source and transform nodes -> wordpress__wp_settings fetched : 1\r\n⠂ source and transform nodes -> wordpress__wp_credential fetched : 2\r\nsuccess source and transform nodes — 12.415 s\r\nsuccess building schema — 1.557 s\r\nsuccess createPages — 3.742 s\r\nsuccess createPagesStatefully — 0.193 s\r\nsuccess onPreExtractQueries — 0.001 s\r\nsuccess update schema — 1.071 s\r\nwarning There are conflicting field types in your data. GraphQL schema will omit those fields.\r\nwordpress__wp_media.media_details.width:\r\n - type: number\r\n   value: 4896\r\n - type: string\r\n   value: '1600'\r\nwordpress__wp_media.media_details.height:\r\n - type: number\r\n   value: 2752\r\n - type: string\r\n   value: '953'\r\nfirestoreTour.versions[].hotels[].hotelID:\r\n - type: number\r\n   value: 0\r\n - type: string\r\n   value: '204'\r\nsuccess extract queries from components — 0.806 s\r\nsuccess run graphql queries — 0.091 s\r\nsuccess write out page data — 0.090 s\r\nsuccess write out redirect data — 0.001 s\r\nsuccess onPostBootstrap — 0.001 s\r\n\r\ninfo bootstrap finished - 29.594 s\r\n\r\nsuccess Building production JavaScript and CSS bundles — 101.468 s\r\n\r\nerror Building static HTML for pages failed\r\n\r\nSee our docs page on debugging HTML builds for help https://goo.gl/yL9lND\r\n\r\n  38 |       var args = [a, b, c, d, e, f];\r\n  39 |       var argIndex = 0;\r\n> 40 |       error = new Error(\r\n     | ^\r\n  41 |         format.replace(/%s/g, function() { return args[argIndex++]; })\r\n  42 |       );\r\n  43 |       error.name = 'Invariant Violation';\r\n\r\n\r\n  WebpackError: Invariant Violation: Could not find \"store\" in either the context or props of \"Connect(FiltersPage)\".   Either wrap the root component in a <Provider>, or explicitly pass \"store\" as a prop to \"Connect(FiltersPage)\".\r\n  \r\n  - invariant.js:40 invariant\r\n    [lib]/[invariant]/invariant.js:40:1\r\n  \r\n  - connectAdvanced.js:117 new Connect\r\n    [lib]/[react-redux]/es/components/connectAdvanced.js:117:1\r\n  \r\n  - react-dom-server.node.production.min.js:26 d\r\n    [lib]/[react-dom]/cjs/react-dom-server.node.production.min.js:26:314\r\n  \r\n  - react-dom-server.node.production.min.js:28 wa\r\n    [lib]/[react-dom]/cjs/react-dom-server.node.production.min.js:28:493\r\n  \r\n  - react-dom-server.node.production.min.js:33 a../node_modules/react-dom/cjs/react-dom-server.node.production.min.js.    a.render\r\n    [lib]/[react-dom]/cjs/react-dom-server.node.production.min.js:33:46\r\n  \r\n  - react-dom-server.node.production.min.js:32 a../node_modules/react-dom/cjs/react-dom-server.node.production.min.js.    a.read\r\n    [lib]/[react-dom]/cjs/react-dom-server.node.production.min.js:32:246\r\n  \r\n  - react-dom-server.node.production.min.js:43 renderToString\r\n    [lib]/[react-dom]/cjs/react-dom-server.node.production.min.js:43:1\r\n  \r\n  - static-entry.js:170 Object._default [as default]\r\n    lib/.cache/static-entry.js:170:16\r\n  \r\n  - bootstrap:12 Worker.Queue [as fn]\r\n    lib/webpack/bootstrap:12:1\r\n  \r\n  - bootstrap:58 Worker.start\r\n    lib/webpack/bootstrap:58:1\r\n  \r\n  \r\n  - gatsby-browser-entry.js:36 \r\n    lib/.cache/gatsby-browser-entry.js:36:7\r\n  \r\n  - bootstrap:76 MemoryStore.getLock\r\n    lib/webpack/bootstrap:76:1\r\n  \r\n  \r\n  - bootstrap:58 MemoryStore.takeFirstN\r\n    lib/webpack/bootstrap:58:1\r\n  \r\n  - find-page.js:27 Queue._getNextBatch\r\n    lib/.cache/find-page.js:27:7\r\n```\r\n\r\n### Environment\r\n\r\n<!--\r\n  Required. Run `gatsby info --clipboard` in your gatsby project directory and paste its contents here.\r\n  Not working? You may need to update your global gatsby-cli - `npm install -g gatsby-cli`\r\n-->\r\n```\r\n  System:\r\n    OS: Linux 4.17 Solus 3.9999\r\n    CPU: x64 Intel(R) Core(TM) i7-2820QM CPU @ 2.30GHz\r\n    Shell: 4.4.19 - /bin/bash\r\n  Binaries:\r\n    Node: 8.11.3 - /usr/bin/node\r\n    Yarn: 1.7.0 - /usr/bin/yarn\r\n    npm: 5.6.0 - /usr/bin/npm\r\n  Browsers:\r\n    Firefox: 61.0\r\n  npmPackages:\r\n    gatsby: next => 2.0.0-beta.13 \r\n    gatsby-cli: next => 2.0.0-beta.3 \r\n    gatsby-paginate: next => 1.0.16 \r\n    gatsby-plugin-less: next => 2.0.0-beta.3 \r\n    gatsby-plugin-react-helmet: next => 3.0.0-beta.3 \r\n    gatsby-source-firebase: next => 1.0.0 \r\n    gatsby-source-firestore: next => 1.0.2 \r\n    gatsby-source-wordpress: next => 3.0.0-beta.4 \r\n  npmGlobalPackages:\r\n    gatsby-cli: 1.1.58\r\n```\r\n\r\n\r\n### File contents (if changed)\r\n\r\n`gatsby-browser.js`:\r\n```import React from 'react'\r\nimport { Router } from 'react-router-dom'\r\nimport { Provider } from 'react-redux'\r\nimport firebase from 'firebase/app'\r\n\r\nimport createStore from './src/state/createStore'\r\nimport { loadState, saveState } from './src/state/localStorage'\r\n\r\nconst config = {\r\n  apiKey: 'AIzaSyC4PU0ILY45uZ3oDe5Y4S-w6go1dRVHF4E',\r\n  authDomain: 'tourasia-ch.firebaseapp.com',\r\n  databaseURL: 'https://tourasia-ch.firebaseio.com',\r\n  projectId: 'tourasia-ch',\r\n  storageBucket: 'tourasia-ch.appspot.com',\r\n  messagingSenderId: '712966527886'\r\n}\r\nfirebase.initializeApp(config)\r\n\r\nconst persistedState = loadState()\r\n\r\nexport const replaceRouterComponent = ({ history }) => {\r\n  const store = createStore(persistedState)\r\n\r\n  store.subscribe(() => {\r\n    saveState({\r\n      wishlist: store.getState().wishlist\r\n    })\r\n  })\r\n\r\n  const ConnectedRouterWrapper = ({ children }) => (\r\n    <Provider store={store}>\r\n      <Router history={history}>{children}</Router>\r\n    </Provider>\r\n  )\r\n\r\n  return ConnectedRouterWrapper\r\n}\r\n```\r\n\r\n`gatsby-ssr.js`: \r\n```import React from 'react'\r\nimport { Provider } from 'react-redux'\r\nimport { renderToString } from 'react-dom/server'\r\n\r\nimport createStore from './src/state/createStore'\r\n\r\nexports.replaceRenderer = ({ bodyComponent, replaceBodyHTMLString }) => {\r\n  const store = createStore()\r\n\r\n  const ConnectedBody = () => (\r\n    <Provider store={store}>\r\n      {bodyComponent}\r\n    </Provider>\r\n  )\r\n  replaceBodyHTMLString(renderToString(<ConnectedBody />))\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/comments/404470941","html_url":"https://github.com/gatsbyjs/gatsby/issues/6362#issuecomment-404470941","issue_url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/6362","id":404470941,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNDQ3MDk0MQ==","user":{"login":"pippo111","id":22401020,"node_id":"MDQ6VXNlcjIyNDAxMDIw","avatar_url":"https://avatars1.githubusercontent.com/u/22401020?v=4","gravatar_id":"","url":"https://api.github.com/users/pippo111","html_url":"https://github.com/pippo111","followers_url":"https://api.github.com/users/pippo111/followers","following_url":"https://api.github.com/users/pippo111/following{/other_user}","gists_url":"https://api.github.com/users/pippo111/gists{/gist_id}","starred_url":"https://api.github.com/users/pippo111/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pippo111/subscriptions","organizations_url":"https://api.github.com/users/pippo111/orgs","repos_url":"https://api.github.com/users/pippo111/repos","events_url":"https://api.github.com/users/pippo111/events{/privacy}","received_events_url":"https://api.github.com/users/pippo111/received_events","type":"User","site_admin":false},"created_at":"2018-07-12T10:45:35Z","updated_at":"2018-07-12T10:45:35Z","author_association":"NONE","body":"@m-allanson I think I got it. When I remove redux connect from page component everything builds. So it seems that u cannot export gatsby page graphql query along with react redux HOC connect... Is this known and default behavior for v2 ?"}}
{"actor":{"display_login":"pippo111"}}