{"action":"created","issue":{"url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/3571","repository_url":"https://api.github.com/repos/gatsbyjs/gatsby","labels_url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/3571/labels{/name}","comments_url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/3571/comments","events_url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/3571/events","html_url":"https://github.com/gatsbyjs/gatsby/issues/3571","id":289440968,"number":3571,"title":"Inner exception message : \"The OAuth2 token is invalid.\"","user":{"login":"sebhewelt","id":13302050,"avatar_url":"https://avatars3.githubusercontent.com/u/13302050?v=4","gravatar_id":"","url":"https://api.github.com/users/sebhewelt","html_url":"https://github.com/sebhewelt","followers_url":"https://api.github.com/users/sebhewelt/followers","following_url":"https://api.github.com/users/sebhewelt/following{/other_user}","gists_url":"https://api.github.com/users/sebhewelt/gists{/gist_id}","starred_url":"https://api.github.com/users/sebhewelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sebhewelt/subscriptions","organizations_url":"https://api.github.com/users/sebhewelt/orgs","repos_url":"https://api.github.com/users/sebhewelt/repos","events_url":"https://api.github.com/users/sebhewelt/events{/privacy}","received_events_url":"https://api.github.com/users/sebhewelt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-01-17T22:45:05Z","updated_at":"2018-05-25T14:05:42Z","closed_at":null,"author_association":"NONE","body":"\r\n## Description\r\n\r\nPulling posts from wordpress doesn't work on netlify, but works fine locally.\r\n\r\n### Environment\r\n\r\nGatsby version: 1.9.92\r\nNode.js version: 8.5.0\r\n\r\n### Actual result\r\n\r\nNetlify build log:\r\n\r\n```\r\n11:02:21 PM: Build ready to start\r\n11:02:23 PM: Fetching cached dependencies\r\n11:02:23 PM: Failed to fetch cache, continuing with build\r\n11:02:23 PM: Starting to prepare the repo for build\r\n11:02:24 PM: No cached dependencies found. Cloning fresh repo\r\n11:02:24 PM: git clone git@github.com:sebhewelt/sebhewelt-gatsby\r\n11:02:25 PM: Preparing Git Reference refs/heads/master\r\n11:02:25 PM: Running build command: gatsby build --prefix-paths\r\n11:02:25 PM: Installing dependencies\r\n11:02:26 PM: Using node version 'v8.5.0' from .nvmrc\r\n11:02:26 PM: Downloading and installing node v8.5.0...\r\n11:02:27 PM: Downloading https://nodejs.org/dist/v8.5.0/node-v8.5.0-linux-x64.tar.xz...\r\n11:02:27 PM: \r\n#\r\n11:02:27 PM:                                                            2.5%\r\n11:02:27 PM: #\r\n11:02:27 PM: #####                                                                     9.1%\r\n11:02:27 PM: #\r\n11:02:27 PM: ##########                                                               16.6%\r\n11:02:27 PM: #\r\n11:02:27 PM: ################                                                         24.5%\r\n11:02:27 PM: \r\n################\r\n11:02:27 PM: #######                                                   32.6%\r\n11:02:27 PM: #\r\n11:02:27 PM: ############################                                             40.8%\r\n11:02:28 PM: #\r\n11:02:28 PM: #################################                                        48.5%\r\n11:02:28 PM: #\r\n11:02:28 PM: #######################################                                  56.4%\r\n11:02:28 PM: #\r\n11:02:28 PM: #############################################                            64.4%\r\n11:02:28 PM: #\r\n11:02:28 PM: ###################################################                      72.7%\r\n11:02:28 PM: #\r\n11:02:28 PM: #########################################################                80.6%\r\n11:02:28 PM: #\r\n11:02:28 PM: ##############################################################           88.3%\r\n11:02:28 PM: \r\n###################\r\n11:02:28 PM: #################################################      95.7%\r\n11:02:28 PM: \r\n##################\r\n11:02:28 PM: ###################################################### 100.0%\r\n11:02:28 PM: Computing checksum with sha256sum\r\n11:02:28 PM: Checksums matched!\r\n11:02:31 PM: Now using node v8.5.0 (npm v5.3.0)\r\n11:02:31 PM: Using version v8.5.0 of node\r\n11:02:31 PM: Using /opt/buildhome/.rvm/gems/ruby-2.1.2\r\n11:02:32 PM: Installing NPM modules using NPM version 5.3.0\r\n11:02:34 PM: npm\r\n11:02:34 PM: WARN deprecated babel-preset-es2015@6.24.1: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!\r\n11:03:19 PM: > uws@0.14.5 install /opt/build/repo/node_modules/uws\r\n11:03:19 PM: > node-gyp rebuild > build_log.txt 2>&1 || exit 0\r\n11:03:30 PM: > node-sass@4.7.2 install /opt/build/repo/node_modules/node-sass\r\n11:03:31 PM: > node scripts/install.js\r\n11:03:31 PM: Downloading binary from https://github.com/sass/node-sass/releases/download/v4.7.2/linux-x64-57_binding.node\r\n11:03:38 PM: Download complete\r\n11:03:38 PM: Binary saved to /opt/build/repo/node_modules/node-sass/vendor/linux-x64-57/binding.node\r\n11:03:38 PM: Caching binary to /opt/buildhome/.npm/node-sass/4.7.2/linux-x64-57_binding.node\r\n11:03:39 PM: > node-sass@4.7.2 postinstall /opt/build/repo/node_modules/node-sass\r\n11:03:39 PM: > node scripts/build.js\r\n11:03:39 PM: Binary found at /opt/build/repo/node_modules/node-sass/vendor/linux-x64-57/binding.node\r\n11:03:39 PM: Testing binary\r\n11:03:39 PM: Binary is fine\r\n11:03:42 PM: npm\r\n11:03:42 PM: notice created a lockfile as package-lock.json. You should commit this file.\r\n11:03:42 PM: npm WARN eslint-plugin-import@2.8.0 requires a peer of eslint@2.x - 4.x but none was installed.\r\n11:03:42 PM: npm WARN eslint-plugin-jsx-a11y@5.1.1 requires a peer of eslint@^2.10.2 || ^3 || ^4 but none was installed.\r\n11:03:42 PM: npm WARN eslint-plugin-react@7.5.1 requires a peer of eslint@^3.0.0 || ^4.0.0 but none was installed.\r\n11:03:42 PM: npm WARN gatsby-starter-default@1.0.0 No repository field.\r\n11:03:42 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/fsevents):\r\n11:03:42 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {\"os\":\"darwin\",\"arch\":\"any\"} (current: {\"os\":\"linux\",\"arch\":\"x64\"})\r\n11:03:42 PM: added 1762 packages in 69.626s\r\n11:03:42 PM: NPM modules installed\r\n11:03:43 PM: Installing missing commands\r\n11:03:43 PM: Executing user command: gatsby build --prefix-paths\r\n11:03:44 PM: success delete html files from previous builds — 0.010 s\r\n11:03:44 PM: success open and validate gatsby-config.js — 0.005 s\r\n11:03:45 PM: success copy gatsby files — 0.020 s\r\n11:03:45 PM: success onPreBootstrap — 0.005 s\r\n11:03:45 PM: Starting to fetch data from Contentful\r\n11:03:45 PM: Fetching default locale\r\n11:03:45 PM: default local is : en-US\r\n11:03:45 PM: contentTypes fetched 3\r\n11:03:45 PM: Updated entries  6\r\n11:03:45 PM: Deleted entries  0\r\n11:03:45 PM: Updated assets  6\r\n11:03:45 PM: Deleted assets  0\r\n11:03:45 PM: Fetch Contentful data: 685.099ms\r\n11:03:46 PM: The server response was \"400 Bad Request\"\r\n11:03:46 PM: The server response was \"401 Unauthorized\"\r\n11:03:46 PM: Inner exception message : \"The OAuth2 token is invalid.\"\r\n11:03:46 PM: The server response was \"401 Unauthorized\"\r\n11:03:46 PM: Inner exception message : \"The OAuth2 token is invalid.\"\r\n11:03:46 PM: The server response was \"401 Unauthorized\"\r\n11:03:46 PM: Inner exception message : \"The OAuth2 token is invalid.\"\r\n11:03:47 PM: The server response was \"401 Unauthorized\"\r\n11:03:47 PM: Inner exception message : \"The OAuth2 token is invalid.\"\r\n11:03:47 PM: The server response was \"401 Unauthorized\"\r\n11:03:47 PM: Inner exception message : \"The OAuth2 token is invalid.\"\r\n11:03:47 PM: The server response was \"401 Unauthorized\"\r\n11:03:47 PM: Inner exception message : \"The OAuth2 token is invalid.\"\r\n11:03:47 PM: The server response was \"401 Unauthorized\"\r\n11:03:47 PM: Inner exception message : \"The OAuth2 token is invalid.\"\r\n11:03:47 PM: The server response was \"401 Unauthorized\"\r\n11:03:47 PM: Inner exception message : \"The OAuth2 token is invalid.\"\r\n11:03:47 PM: The server response was \"401 Unauthorized\"\r\n11:03:47 PM: Inner exception message : \"The OAuth2 token is invalid.\"\r\n11:03:47 PM: The server response was \"401 Unauthorized\"\r\n11:03:47 PM: Inner exception message : \"The OAuth2 token is invalid.\"\r\n11:03:47 PM: The server response was \"401 Unauthorized\"\r\n11:03:47 PM: Inner exception message : \"The OAuth2 token is invalid.\"\r\n11:03:47 PM: The server response was \"401 Unauthorized\"\r\n11:03:47 PM: Inner exception message : \"The OAuth2 token is invalid.\"\r\n11:03:48 PM: The server response was \"401 Unauthorized\"\r\n11:03:48 PM: Inner exception message : \"The OAuth2 token is invalid.\"\r\n11:03:48 PM: The server response was \"401 Unauthorized\"\r\n11:03:48 PM: Inner exception message : \"The OAuth2 token is invalid.\"\r\n11:03:48 PM: The server response was \"401 Unauthorized\"\r\n11:03:48 PM: Inner exception message : \"The OAuth2 token is invalid.\"\r\n11:03:48 PM: The server response was \"404 Not Found\"\r\n11:03:48 PM: Inner exception message : \"No route was found matching the URL and request method\"\r\n11:03:48 PM: warning The gatsby-source-wordpress plugin has generated no Gatsby nodes. Do you need it?\r\n11:03:48 PM: success source and transform nodes — 3.319 s\r\n11:03:48 PM: success building schema — 0.251 s\r\n11:03:48 PM: success createLayouts — 0.024 s\r\n11:03:48 PM: [ { GraphQLError: Cannot query field \"allWordpressPost\" on type \"RootQueryType\".\r\n11:03:48 PM:       at Object.Field (/opt/build/repo/node_modules/graphql/validation/rules/FieldsOnCorrectType.js:65:31)\r\n11:03:48 PM:       at Object.enter (/opt/build/repo/node_modules/graphql/language/visitor.js:295:29)\r\n11:03:48 PM:       at Object.enter (/opt/build/repo/node_modules/graphql/language/visitor.js:337:25)\r\n11:03:48 PM:       at visit (/opt/build/repo/node_modules/graphql/language/visitor.js:227:26)\r\n11:03:48 PM:       at visitUsingRules (/opt/build/repo/node_modules/graphql/validation/validate.js:75:22)\r\n11:03:48 PM:       at validate (/opt/build/repo/node_modules/graphql/validation/validate.js:60:10)\r\n11:03:48 PM:       at /opt/build/repo/node_modules/graphql/graphql.js:69:51\r\n11:03:48 PM:       at Promise._execute (/opt/build/repo/node_modules/bluebird/js/release/debuggability.js:303:9)\r\n11:03:48 PM:       at Promise._resolveFromExecutor (/opt/build/repo/node_modules/bluebird/js/release/promise.js:483:18)\r\n11:03:48 PM:       at new Promise (/opt/build/repo/node_modules/bluebird/js/release/promise.js:79:10)\r\n11:03:48 PM:       at graphqlImpl (/opt/build/repo/node_modules/graphql/graphql.js:59:10)\r\n11:03:48 PM:       at graphql (/opt/build/repo/node_modules/graphql/graphql.js:48:227)\r\n11:03:48 PM:       at graphqlRunner (/opt/build/repo/node_modules/gatsby/dist/bootstrap/index.js:368:22)\r\n11:03:48 PM:       at Promise (/opt/build/repo/gatsby-node.js:10:5)\r\n11:03:49 PM:       at Promise._execute (/opt/build/repo/node_modules/bluebird/js/release/debuggability.js:303:9)\r\n11:03:49 PM:       at Promise._resolveFromExecutor (/opt/build/repo/node_modules/bluebird/js/release/promise.js:483:18)\r\n11:03:49 PM:     message: 'Cannot query field \"allWordpressPost\" on type \"RootQueryType\".',\r\n11:03:49 PM:     locations: [ [Object] ],\r\n11:03:49 PM:     path: undefined } ]\r\n11:03:49 PM: error gatsby-node.js returned an error\r\n11:03:49 PM: \r\n11:03:49 PM:   Error: \r\n11:03:49 PM: \r\n11:03:49 PM: success createPages — 0.034 s\r\n11:03:49 PM: error Cannot read property 'allWordpressPost' of undefined\r\n11:03:49 PM: \r\n11:03:49 PM:   TypeError: Cannot read property 'allWordpressPost' of undefined\r\n11:03:49 PM:   \r\n11:03:49 PM:   - gatsby-node.js:30 graphql.then.result\r\n11:03:49 PM:     /opt/build/repo/gatsby-node.js:30:25\r\n11:03:49 PM:   \r\n11:03:49 PM:   - util.js:16 tryCatcher\r\n11:03:49 PM:     [repo]/[bluebird]/js/release/util.js:16:23\r\n11:03:49 PM:   \r\n11:03:49 PM:   - promise.js:512 Promise._settlePromiseFromHandler\r\n11:03:49 PM:     [repo]/[bluebird]/js/release/promise.js:512:31\r\n11:03:49 PM:   \r\n11:03:49 PM:   - promise.js:569 Promise._settlePromise\r\n11:03:49 PM:     [repo]/[bluebird]/js/release/promise.js:569:18\r\n11:03:49 PM:   \r\n11:03:49 PM:   - promise.js:606 Promise._settlePromiseCtx\r\n11:03:49 PM:     [repo]/[bluebird]/js/release/promise.js:606:10\r\n11:03:49 PM:   \r\n11:03:49 PM:   - async.js:138 Async._drainQueue\r\n11:03:49 PM:     [repo]/[bluebird]/js/release/async.js:138:12\r\n11:03:49 PM:   \r\n11:03:49 PM:   - async.js:143 Async._drainQueues\r\n11:03:49 PM:     [repo]/[bluebird]/js/release/async.js:143:10\r\n11:03:49 PM:   \r\n11:03:49 PM:   - async.js:17 Immediate.Async.drainQueues\r\n11:03:49 PM:     [repo]/[bluebird]/js/release/async.js:17:14\r\n11:03:49 PM:   \r\n11:03:49 PM: \r\n11:03:49 PM: error UNHANDLED REJECTION\r\n11:03:49 PM: \r\n11:03:49 PM:   TypeError: Cannot read property 'allWordpressPost' of undefined\r\n11:03:49 PM:   \r\n11:03:49 PM:   - gatsby-node.js:30 graphql.then.result\r\n11:03:49 PM:     /opt/build/repo/gatsby-node.js:30:25\r\n11:03:49 PM:   \r\n11:03:49 PM:   - util.js:16 tryCatcher\r\n11:03:49 PM:     [repo]/[bluebird]/js/release/util.js:16:23\r\n11:03:49 PM:   \r\n11:03:49 PM:   - promise.js:512 Promise._settlePromiseFromHandler\r\n11:03:49 PM:     [repo]/[bluebird]/js/release/promise.js:512:31\r\n11:03:49 PM:   \r\n11:03:49 PM:   - promise.js:569 Promise._settlePromise\r\n11:03:49 PM:     [repo]/[bluebird]/js/release/promise.js:569:18\r\n11:03:49 PM:   \r\n11:03:49 PM:   - promise.js:606 Promise._settlePromiseCtx\r\n11:03:49 PM:     [repo]/[bluebird]/js/release/promise.js:606:10\r\n11:03:49 PM:   \r\n11:03:49 PM:   - async.js:138 Async._drainQueue\r\n11:03:49 PM:     [repo]/[bluebird]/js/release/async.js:138:12\r\n11:03:49 PM:   \r\n11:03:49 PM:   - async.js:143 Async._drainQueues\r\n11:03:49 PM:     [repo]/[bluebird]/js/release/async.js:143:10\r\n11:03:49 PM:   \r\n11:03:49 PM:   - async.js:17 Immediate.Async.drainQueues\r\n11:03:49 PM:     [repo]/[bluebird]/js/release/async.js:17:14\r\n11:03:49 PM:   \r\n11:03:50 PM: \r\n11:03:50 PM: Caching artifacts\r\n11:03:50 PM: Cached NPM modules\r\n11:03:50 PM: Saved Cache Directory\r\n11:03:50 PM: Build complete: exit code: 1\r\n11:03:50 PM: Error running command: Build script returned non-zero exit code: 1\r\n11:03:50 PM: Failing build: Failed to build site\r\n11:03:50 PM: failed during stage 'building site': Build script returned non-zero exit code: 1\r\n11:03:50 PM: Finished processing build request in 1m27.474470802s\r\n```\r\n\r\n### Expected behavior\r\n\r\nThe same as locally. To pull all the data from wordpress without a problem. Here's the console log on running `gatsby develop `locally: \r\n\r\n````\r\n$ gatsby develop\r\nsuccess delete html files from previous builds — 0.069 s\r\nsuccess open and validate gatsby-config.js — 0.023 s\r\nsuccess copy gatsby files — 0.187 s\r\nsuccess onPreBootstrap — 0.014 s\r\n⠁ Starting to fetch data from Contentful\r\nFetching default locale\r\n⡀ source and transform nodesdefault local is : en-US\r\n⠁ source and transform nodescontentTypes fetched 3\r\nUpdated entries  0\r\nDeleted entries  0\r\nUpdated assets  0\r\nDeleted assets  0\r\nFetch Contentful data: 510.572ms\r\n⠠ source and transform nodes -> wordpress__POST fetched : 2\r\n⠄ source and transform nodes -> wordpress__PAGE fetched : 1\r\n⠁ source and transform nodes -> wordpress__wp_media fetched : 1\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 : 2\r\n⡀ source and transform nodes -> wordpress__TAG fetched : 8\r\n⠂ source and transform nodes -> wordpress__wp_users fetched : 1\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 nodesThe server response was \"404 Not Found\"\r\nInner exception message : \"No route was found matching the URL and request method\"\r\nsuccess source and transform nodes — 7.587 s\r\nsuccess building schema — 4.292 s\r\nsuccess createLayouts — 0.021 s\r\nsuccess createPages — 0.186 s\r\nsuccess createPagesStatefully — 0.045 s\r\nsuccess onPreExtractQueries — 0.004 s\r\nsuccess update schema — 0.479 s\r\nsuccess extract queries from components — 0.657 s\r\nsuccess run graphql queries — 0.030 s\r\nsuccess write out page data — 0.014 s\r\nsuccess write out redirect data — 0.002 s\r\nsuccess onPostBootstrap — 0.002 s\r\n\r\ninfo bootstrap finished - 54 s\r\n\r\nDONE  Compiled successfully in 19851ms                                                                                               23:36:13\r\n\r\nYou can now view gatsby-starter-default in the browser.\r\n\r\n  http://localhost:8000/\r\n\r\nView GraphiQL, an in-browser IDE, to explore your site's data and schema\r\n\r\n  http://localhost:8000/___graphql\r\n\r\nNote that the development build is not optimized.\r\nTo create a production build, use gatsby build\r\n\r\n````\r\n\r\n\r\n\r\n\r\nI can provide additional info if needed. The repo is private, though I can give access if needed. \r\nI don't have any env variables, all access tokens/keys are directly in gatsby-config file:\r\n\r\n\r\n\r\n```\r\nmodule.exports = {\r\n  siteMetadata: {\r\n    title: `Sebastian Hewelt - portfolio`\r\n  },\r\n  plugins: [\r\n    `gatsby-plugin-react-helmet`,\r\n    `gatsby-plugin-sass`,\r\n    {\r\n      resolve: `gatsby-source-contentful`,\r\n      options: {\r\n        spaceId: 'spaceIdhere',\r\n        accessToken:\r\n          'accessTokenHere'\r\n      }\r\n    },\r\n    {\r\n      resolve: 'gatsby-source-wordpress',\r\n      options: {\r\n        baseUrl: 'sebastianheweltportfolioprojekty.wordpress.com',\r\n        protocol: 'http',\r\n        hostingWPCOM: true,\r\n        useACF: true,\r\n        auth: {\r\n          wpcom_app_clientSecret:\r\n            'clientSecretHere',\r\n          wpcom_app_clientId: 'clientIdHere',\r\n          wpcom_user: 'sebastianhewelt@gmail.com',\r\n          wpcom_pass: 'wpcomPassHere'\r\n        },\r\n        verboseOutput: false\r\n      }\r\n    },\r\n    `gatsby-transformer-remark`,\r\n    `gatsby-plugin-styled-components`\r\n  ]\r\n};\r\n```"},"comment":{"url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/comments/392068727","html_url":"https://github.com/gatsbyjs/gatsby/issues/3571#issuecomment-392068727","issue_url":"https://api.github.com/repos/gatsbyjs/gatsby/issues/3571","id":392068727,"user":{"login":"gllmt","id":29959267,"avatar_url":"https://avatars0.githubusercontent.com/u/29959267?v=4","gravatar_id":"","url":"https://api.github.com/users/gllmt","html_url":"https://github.com/gllmt","followers_url":"https://api.github.com/users/gllmt/followers","following_url":"https://api.github.com/users/gllmt/following{/other_user}","gists_url":"https://api.github.com/users/gllmt/gists{/gist_id}","starred_url":"https://api.github.com/users/gllmt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gllmt/subscriptions","organizations_url":"https://api.github.com/users/gllmt/orgs","repos_url":"https://api.github.com/users/gllmt/repos","events_url":"https://api.github.com/users/gllmt/events{/privacy}","received_events_url":"https://api.github.com/users/gllmt/received_events","type":"User","site_admin":false},"created_at":"2018-05-25T14:05:42Z","updated_at":"2018-05-25T14:05:42Z","author_association":"NONE","body":"Hello @sebhewelt , same problem, did you find a solution ?"}}
{"actor":{"display_login":"gllmt"}}