sanity-io / sanity-template-gatsby-portfolio

A Gatsby portfolio site powered by Sanity for https://www.sanity.io/create
https://www.sanity.io/create/?template=sanity-io%2Fsanity-template-gatsby-portfolio
69 stars 18 forks source link

New project first site deploy build fails with "TypeError: createPageDependency is not a function" #3

Closed SpacemanPete closed 5 years ago

SpacemanPete commented 5 years ago

Hello!

I tried to spin up a new project using the Portfolio Template from sanity.io/create. The studio netlify site builds fine but the Gatsby site on Netlify fails in its first deploy job with the error message:

TypeError: createPageDependency is not a function

I did no customizations to the codebase, I just used the form on the template create page and authorized the connections to my accounts for Sanity, Github, and Netlify.

I'll copy the full output of the Netlify deploy job for troubleshooting:

11:10:55 PM: Build ready to start
11:10:57 PM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
11:10:57 PM: build-image tag: v3.3.2
11:10:57 PM: buildbot version: 75cd99f62ada9e21edea53208e8baf0eab85a045
11:10:58 PM: Fetching cached dependencies
11:10:58 PM: Failed to fetch cache, continuing with build
11:10:58 PM: Starting to prepare the repo for build
11:10:58 PM: No cached dependencies found. Cloning fresh repo
11:10:58 PM: git clone git@github.com:SpacemanPete/inkpebble-studio
11:10:59 PM: Preparing Git Reference refs/heads/master
11:10:59 PM: Starting build script
11:10:59 PM: Installing dependencies
11:11:01 PM: Downloading and installing node v10.16.0...
11:11:01 PM: Downloading https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz...
11:11:02 PM: 
#
11:11:02 PM:   2.4%
11:11:02 PM: 
###############################                                           43.6%
11:11:02 PM: 
###############
11:11:02 PM: ##################################                         68.3%
11:11:02 PM: 
###############################################################
11:11:02 PM: ######### 100.0%
11:11:02 PM: Computing checksum with sha256sum
11:11:02 PM: Checksums matched!
11:11:05 PM: Now using node v10.16.0 (npm v6.9.0)
11:11:05 PM: Attempting ruby version 2.6.2, read from environment
11:11:06 PM: Using ruby version 2.6.2
11:11:07 PM: Using PHP version 5.6
11:11:07 PM: Started restoring cached node modules
11:11:07 PM: Finished restoring cached node modules
11:11:07 PM: Installing NPM modules using NPM version 6.9.0
11:11:25 PM: > inkpebble-studio@0.0.0 postinstall /opt/build/repo
11:11:25 PM: > lerna bootstrap
11:11:25 PM: lerna
11:11:25 PM:  notice
11:11:25 PM: cli v3.14.1
11:11:25 PM: lerna
11:11:25 PM: info Bootstrapping 2 packages
11:11:25 PM: lerna info
11:11:25 PM:  Installing external dependencies
11:12:26 PM: lerna info
11:12:26 PM:  Symlinking packages and binaries
11:12:26 PM: lerna
11:12:26 PM: success Bootstrapped 2 packages
11:12:26 PM: npm
11:12:26 PM:  notice created a lockfile as package-lock.json. You should commit this file.
11:12:26 PM: added 654 packages from 324 contributors and audited 43216 packages in 78.717s
11:12:26 PM: found 0 vulnerabilities
11:12:26 PM: NPM modules installed
11:12:27 PM: Started restoring cached go cache
11:12:27 PM: Finished restoring cached go cache
11:12:27 PM: unset GOOS;
11:12:27 PM: unset GOARCH;
11:12:27 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
11:12:27 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
11:12:27 PM: go version >&2;
11:12:27 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
11:12:27 PM: go version go1.12 linux/amd64
11:12:27 PM: Installing missing commands
11:12:27 PM: Verify run directory
11:12:27 PM: Executing user command: npm run build-web
11:12:27 PM: > inkpebble-studio@0.0.0 build-web /opt/build/repo
11:12:27 PM: > (cd studio && SANITY_AUTH_TOKEN=$SANITY_DEPLOY_STUDIO_TOKEN npm run graphql-deploy) && (cd web && npm run build)
11:12:27 PM: > inkpebble-studio-studio@1.0.0 graphql-deploy /opt/build/repo/studio
11:12:27 PM: > sanity graphql deploy --playground
11:12:31 PM: GraphQL API deployed to:
11:12:31 PM: https://3z5dqp48.api.sanity.io/v1/graphql/production/default
11:12:32 PM: > inkpebble-studio-web@1.0.0 build /opt/build/repo/web
11:12:32 PM: > gatsby build
11:12:34 PM: success open and validate gatsby-configs — 0.006 s
11:12:35 PM: success load plugins — 0.368 s
11:12:35 PM: success onPreInit — 0.006 s
11:12:35 PM: success delete html and css files from previous builds — 0.005 s
11:12:35 PM: success initialize cache — 0.008 s
11:12:35 PM: success copy gatsby files — 0.025 s
11:12:35 PM: info [sanity] Fetching remote GraphQL schema
11:12:35 PM: info [sanity] Transforming to Gatsby-compatible GraphQL SDL
11:12:35 PM: info [sanity] Stitching GraphQL schemas from SDL
11:12:35 PM: success onPreBootstrap — 0.410 s
11:12:35 PM: info [sanity] Fetching export stream for dataset
11:12:35 PM: info [sanity] Done exporting!
11:12:35 PM: success source and transform nodes — 0.333 s
11:12:36 PM: warning `createResolvers` passed resolvers for type `SanityRootQuery` that doesn't exist in the schema. Use `createTypes` to add the type before adding resolvers.
11:12:36 PM: success building schema — 0.240 s
11:12:36 PM: info Creating project page: /project/geodesic-cabin/
11:12:36 PM: error gatsby-node.js returned an error
11:12:36 PM: 
11:12:36 PM:   TypeError: createPageDependency is not a function
11:12:36 PM:   
11:12:36 PM:   - gatsby-node.js:45 projectEdges.filter.forEach.edge
11:12:36 PM:     /opt/build/repo/web/gatsby-node.js:45:7
11:12:36 PM:   
11:12:36 PM:   - Array.forEach
11:12:36 PM:   
11:12:36 PM:   - gatsby-node.js:32 createProjectPages
11:12:36 PM:     /opt/build/repo/web/gatsby-node.js:32:6
11:12:36 PM:   
11:12:36 PM: 
11:12:36 PM: npm
11:12:36 PM:  ERR! code ELIFECYCLE
11:12:36 PM: npm ERR! errno 1
11:12:36 PM: npm
11:12:36 PM:  ERR! inkpebble-studio-web@1.0.0 build: `gatsby build`
11:12:36 PM: npm ERR! Exit status 1
11:12:36 PM: npm ERR!
11:12:36 PM: npm ERR!
11:12:36 PM:  Failed at the inkpebble-studio-web@1.0.0 build script.
11:12:36 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
11:12:36 PM: npm
11:12:36 PM: ERR! A complete log of this run can be found in:
11:12:36 PM: npm ERR!     /opt/buildhome/.npm/_logs/2019-06-09T03_12_36_336Z-debug.log
11:12:36 PM: npm
11:12:36 PM:  ERR!
11:12:36 PM: code ELIFECYCLE
11:12:36 PM: npm
11:12:36 PM: ERR!
11:12:36 PM: errno
11:12:36 PM:  1
11:12:36 PM: npm ERR! inkpebble-studio@0.0.0 build-web: `(cd studio && SANITY_AUTH_TOKEN=$SANITY_DEPLOY_STUDIO_TOKEN npm run graphql-deploy) && (cd web && npm run build)`
11:12:36 PM: npm
11:12:36 PM: ERR! Exit status 1
11:12:36 PM: npm
11:12:36 PM:  ERR!
11:12:36 PM: npm
11:12:36 PM:  ERR!
11:12:36 PM:  Failed at the inkpebble-studio@0.0.0 build-web script.
11:12:36 PM: npm
11:12:36 PM:  ERR! This is probably not a problem with npm. There is likely additional logging output above.
11:12:36 PM: npm ERR! A complete log of this run can be found in:
11:12:36 PM: npm ERR!     /opt/buildhome/.npm/_logs/2019-06-09T03_12_36_361Z-debug.log
11:12:36 PM: Skipping functions preparation step: no functions directory set
11:12:36 PM: Caching artifacts
11:12:36 PM: Started saving node modules
11:12:36 PM: Finished saving node modules
11:12:36 PM: Started saving pip cache
11:12:36 PM: Finished saving pip cache
11:12:36 PM: Started saving emacs cask dependencies
11:12:36 PM: Finished saving emacs cask dependencies
11:12:36 PM: Started saving maven dependencies
11:12:36 PM: Finished saving maven dependencies
11:12:36 PM: Started saving boot dependencies
11:12:36 PM: Finished saving boot dependencies
11:12:36 PM: Started saving go dependencies
11:12:36 PM: Finished saving go dependencies
11:12:39 PM: Error running command: Build script returned non-zero exit code: 1
11:12:39 PM: Failing build: Failed to build site
11:12:39 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
11:12:39 PM: Finished processing build request in 1m41.310324963s
11:12:39 PM: Shutting down logging, 0 messages pending
rexxars commented 5 years ago

Thanks for reporting! Seems like Gatsby had removed the createPageDependency method :/ I've updated the template, but you'll have to make the same changes to your local copy as well: https://github.com/sanity-io/sanity-template-gatsby-portfolio/commit/c247567c6d882810a63cd7e25fbe3885f478e856

SpacemanPete commented 5 years ago

@rexxars , tahnks for the quick fix Espen! I was scratching my head on this for so long. I commented out that call and the site started building but the Gatsby docs seemed to describe that method as being necessary and did't mention anything about that method being deprecated yet. I assume it's a new change and will be updated int he docs soon enough. Glad you got to the bottom of it.