contentful-labs / starter-gatsby-blog

Gatsby starter for a Contentful project from the community.
https://contentful.github.io/starter-gatsby-blog/
MIT License
195 stars 199 forks source link

unable to deploy my app #7

Open dikshagaur10 opened 6 years ago

dikshagaur10 commented 6 years ago

I am unable to deploy my app using Heroku with starter-gatsby-blog. When I am running the command git push heroku master, its not finishing and giving me following errors

TypeError: cannot read property "allContentfulBlogPost" of undefined

npm Error! code ELIFECYCLE screenshot 19

npm Error! errno 1

below is the log from Heroku

npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /tmp/npmcache.6jsXf/_logs/2018-09-01T01_22_29_430Z-debug.log -----> Build failed

   We're sorry this build is failing! You can troubleshoot common issues here:
   https://devcenter.heroku.com/articles/troubleshooting-node-deploys

   Some possible problems:

   - Node version not specified in package.json
   https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version

   Love,
   Heroku

! Push rejected, failed to compile Node.js app. ! Push failed

dikshagaur10 commented 6 years ago

-----> Node.js app detected -----> Creating runtime environment

   NPM_CONFIG_LOGLEVEL=error
   NODE_VERBOSE=false
   NODE_ENV=production
   NODE_MODULES_CACHE=true

-----> Installing binaries engines.node (package.json): unspecified engines.npm (package.json): unspecified (use default)

   Resolving node version 8.x...
   Downloading and installing node 8.11.4...
   Using default npm version: 5.6.0

-----> Restoring cache Skipping cache restore (not-found) -----> Building dependencies Installing node modules (package.json + package-lock)

   > sharp@0.20.5 install /tmp/build_12c4d7da02cc9ec83a76f47ea0ccd082/node_modules/sharp
   > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

   info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.6.1/libvips-8.6.1-linux-x64.tar.gz

   > cwebp-bin@4.0.0 postinstall /tmp/build_12c4d7da02cc9ec83a76f47ea0ccd082/node_modules/cwebp-bin
   > node lib/install.js

   ✔ cwebp pre-build test passed successfully

   > pngquant-bin@3.1.1 postinstall /tmp/build_12c4d7da02cc9ec83a76f47ea0ccd082/node_modules/pngquant-bin
   > node lib/install.js

   ✔ pngquant pre-build test passed successfully
   added 1812 packages in 34.064s
   Running heroku-postbuild

   > contentful-starter-gatsby-blog@0.0.1 heroku-postbuild /tmp/build_12c4d7da02cc9ec83a76f47ea0ccd082
   > gatsby build

   success delete html and css files from previous builds — 0.046 s
   success open and validate gatsby-config — 0.008 s
   success copy gatsby files — 0.023 s
   success onPreBootstrap — 0.391 s
   Starting to fetch data from Contentful
   Fetching default locale
   default local is : en-US
   contentTypes fetched 3
   Updated entries  9
   Deleted entries  0
   Updated assets  11
   Deleted assets  0
   Fetch Contentful data: 90.501ms
   success source and transform nodes — 0.173 s
   success building schema — 0.344 s
   success createLayouts — 0.035 s
   [ { GraphQLError: Cannot query field "allContentfulBlogPost" on type "RootQueryType". Did you mean "allContentfulProduct", "allContentfulCategory", "allContentfulBrand", "allContentfulAsset", or "allContentfulContentType"?
   at Object.Field (/tmp/build_12c4d7da02cc9ec83a76f47ea0ccd082/node_modules/graphql/validation/rules/FieldsOnCorrectType.js:65:31)
   at Object.enter (/tmp/build_12c4d7da02cc9ec83a76f47ea0ccd082/node_modules/graphql/language/visitor.js:295:29)
   at Object.enter (/tmp/build_12c4d7da02cc9ec83a76f47ea0ccd082/node_modules/graphql/language/visitor.js:337:25)
   at visit (/tmp/build_12c4d7da02cc9ec83a76f47ea0ccd082/node_modules/graphql/language/visitor.js:227:26)

error gatsby-node.js returned an error at visitUsingRules (/tmp/build_12c4d7da02cc9ec83a76f47ea0ccd082/node_modules/graphql/validation/validate.js:75:22) at validate (/tmp/build_12c4d7da02cc9ec83a76f47ea0ccd082/node_modules/graphql/validation/validate.js:60:10) at /tmp/build_12c4d7da02cc9ec83a76f47ea0ccd082/node_modules/graphql/graphql.js:69:51 at Promise._execute (/tmp/build_12c4d7da02cc9ec83a76f47ea0ccd082/node_modules/bluebird/js/release/debuggability.js:303:9) at Promise._resolveFromExecutor (/tmp/build_12c4d7da02cc9ec83a76f47ea0ccd082/node_modules/bluebird/js/release/promise.js:483:18) at new Promise (/tmp/build_12c4d7da02cc9ec83a76f47ea0ccd082/node_modules/bluebird/js/release/promise.js:79:10) at graphqlImpl (/tmp/build_12c4d7da02cc9ec83a76f47ea0ccd082/node_modules/graphql/graphql.js:59:10) at graphql (/tmp/build_12c4d7da02cc9ec83a76f47ea0ccd082/node_modules/graphql/graphql.js:48:227) at graphqlRunner (/tmp/build_12c4d7da02cc9ec83a76f47ea0ccd082/node_modules/gatsby/dist/bootstrap/index.js:368:22) at Promise (/tmp/build_12c4d7da02cc9ec83a76f47ea0ccd082/gatsby-node.js:10:7) at Promise._execute (/tmp/build_12c4d7da02cc9ec83a76f47ea0ccd082/node_modules/bluebird/js/release/debuggability.js:303:9) at Promise._resolveFromExecutor (/tmp/build_12c4d7da02cc9ec83a76f47ea0ccd082/node_modules/bluebird/js/release/promise.js:483:18) message: 'Cannot query field "allContentfulBlogPost" on type "RootQueryType". Did you mean "allContentfulProduct", "allContentfulCategory", "allContentfulBrand", "allContentfulAsset", or "allContentfulContentType"?', locations: [ [Object] ], path: undefined } ]

     TypeError: Cannot read property 'allContentfulBlogPost' of undefined

     - gatsby-node.js:29 graphql.then.result
       /tmp/build_12c4d7da02cc9ec83a76f47ea0ccd082/gatsby-node.js:29:35

     - util.js:16 tryCatcher
       [build_12c4d7da02cc9ec83a76f47ea0ccd082]/[bluebird]/js/release/util.js:16:23  
     - promise.js:512 Promise._settlePromiseFromHandler
       [build_12c4d7da02cc9ec83a76f47ea0ccd082]/[bluebird]/js/release/promise.js:51    2:31

     - promise.js:569 Promise._settlePromise
       [build_12c4d7da02cc9ec83a76f47ea0ccd082]/[bluebird]/js/release/promise.js:56    9:18

     - promise.js:606 Promise._settlePromiseCtx
       [build_12c4d7da02cc9ec83a76f47ea0ccd082]/[bluebird]/js/release/promise.js:60    6:10

     - async.js:138 Async._drainQueue
       [build_12c4d7da02cc9ec83a76f47ea0ccd082]/[bluebird]/js/release/async.js:138:    12

     - async.js:143 Async._drainQueues
       [build_12c4d7da02cc9ec83a76f47ea0ccd082]/[bluebird]/js/release/async.js:143:    10

     - async.js:17 Immediate.Async.drainQueues
       [build_12c4d7da02cc9ec83a76f47ea0ccd082]/[bluebird]/js/release/async.js:17:1    4

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! contentful-starter-gatsby-blog@0.0.1 heroku-postbuild: gatsby build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the contentful-starter-gatsby-blog@0.0.1 heroku-postbuild script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /tmp/npmcache.WpPHl/_logs/2018-09-01T08_12_47_020Z-debug.log -----> Build failed

   We're sorry this build is failing! You can troubleshoot common issues here:
   https://devcenter.heroku.com/articles/troubleshooting-node-deploys

   Some possible problems:

   - Node version not specified in package.json
   https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version

   Love,
   Heroku

! Push rejected, failed to compile Node.js app. ! Push failed

paul-f-maxson commented 5 years ago

I'm getting the same error during circleCI build

Khaledgarbaya commented 5 years ago

Hey Folks, This example is meant to work with specific content types

message: 'Cannot query field "allContentfulBlogPost" on type "RootQueryType". Did you mean "allContentfulProduct", "allContentfulCategory", "allContentfulBrand", "allContentfulAsset", or "allContentfulContentType"?',

You are querying allContentfulBlogPost which it does not exist, the only possible cases based on your data are "allContentfulProduct", "allContentfulCategory", "allContentfulBrand", "allContentfulAsset", or "allContentfulContentType"

paul-f-maxson commented 5 years ago

Makes sense, sorta confusing that the default template is set up this way.