Gatsby: Netlify build error on gatsby-source-wordpress

Created on 5 Mar 2019  ยท  4Comments  ยท  Source: gatsbyjs/gatsby

Hello, just finished up a website and wanted to use Netlify as host, but i receive erros on build.

I can confirm that the following builds work locally:

  • gatsby develop
  • gatsby build

The following setup for netlify:

  • Repository: github.com/omattman/djb
  • Base directory: frontend
  • Build command: npm run build
  • Publish directory: frontend/public

However when deploying with netlify I get the following message:

9:58:20 PM: Build ready to start
9:58:22 PM: build-image version: 84aca9ba39e0ee86ba194760fbfc51a808f62543
9:58:22 PM: buildbot version: 3636c47facd153a541b88f990b83e5b3db679721
9:58:23 PM: Fetching cached dependencies
9:58:23 PM: Starting to download cache of 254.8KB
9:58:23 PM: Finished downloading cache in 78.697548ms
9:58:23 PM: Starting to extract cache
9:58:23 PM: Failed to fetch cache, continuing with build
9:58:23 PM: Starting to prepare the repo for build
9:58:24 PM: No cached dependencies found. Cloning fresh repo
9:58:24 PM: git clone https://github.com/omattman/djb
9:58:27 PM: Preparing Git Reference refs/heads/master
9:58:28 PM: Starting build script
9:58:28 PM: Installing dependencies
9:58:29 PM: Downloading and installing node v8.15.1...
9:58:29 PM: Downloading https://nodejs.org/dist/v8.15.1/node-v8.15.1-linux-x64.tar.xz...
9:58:30 PM: 
####
9:58:30 PM:   6.4%
9:58:30 PM: 
#####################
9:58:30 PM:            29.6%
9:58:30 PM: 
##########################################
9:58:30 PM:                       59.3%
9:58:30 PM: 
##########################################################                81.7%
9:58:30 PM: 
########################################################################
9:58:30 PM: 100.0%
9:58:30 PM: Computing checksum with sha256sum
9:58:30 PM: Checksums matched!
9:58:33 PM: Now using node v8.15.1 (npm v6.4.1)
9:58:34 PM: Attempting ruby version 2.3.6, read from environment
9:58:35 PM: Using ruby version 2.3.6
9:58:36 PM: Using PHP version 5.6
9:58:36 PM: Started restoring cached node modules
9:58:36 PM: Finished restoring cached node modules
9:58:36 PM: Started restoring cached yarn cache
9:58:36 PM: Finished restoring cached yarn cache
9:58:36 PM: Installing yarn at version 1.3.2
9:58:36 PM: Installing Yarn!
9:58:36 PM: > Downloading tarball...
9:58:36 PM: [1/2]: https://yarnpkg.com/downloads/1.3.2/yarn-v1.3.2.tar.gz -->
9:58:36 PM: /tmp/yarn.tar.gz.H6VqB1rL26
9:58:36 PM:   % Total    % Received % Xferd  Average Speed
9:58:36 PM:  Time    Time     Time  Current
9:58:36 PM:                                  Dload  Upload   Total   Spen
9:58:36 PM: t    Left  Speed
9:58:36 PM: 
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
9:58:36 PM: 
100    91  100    91    0     0    832      0 --:--:-- --:--:-- --:--:--   83
9:58:36 PM: 4
9:58:36 PM: 
  0     0    0     0    0     0      0      0 --:--:-- --:--:--
9:58:36 PM:  --:--:--     0
9:58:36 PM: 
  0     0    0   608    0     0   1685      0 --:--:-- --:--:-- --:--:-- 276
9:58:36 PM: 36
9:58:36 PM: 
100  865k  100  865k    0     0  1248k      0 --:--:-- -
9:58:36 PM: -:--:-- --:--:-- 1248k
9:58:36 PM: [2/2]: https://yarnpkg
9:58:36 PM: .com/downloads/1.3.2/yarn-v1.3.2.tar.gz.asc --> /tmp/yarn.tar.gz.H6VqB1rL26.asc
9:58:36 PM: 
100    95  100    95    0     0   2231      0 --:--:-- --:--:-- --:--:--  2231
9:58:37 PM: 
  0     0    0   612    0     0   3973      0 --:--:-- --:--:-- --:--:--  3973
9:58:37 PM: 
100  1027  100  1027    0     0   5232      0 --:--:-- --:--:--
9:58:37 PM:  --:--:--  5232
9:58:37 PM: > Verifying integrity...
9:58:37 PM: gpg: Signature made Thu 02 Nov 2017 04:44:10 PM UTC using RSA key ID FD2497F5
9:58:37 PM: gpg: Good signature from "Yarn Packaging <[email protected]>"
9:58:37 PM: gpg: Note: This key has expired!
9:58:37 PM: Primary key fingerprint: 72EC F46A 56B4 AD39 C907  BBB7 1646 B01B 86E5 0310
9:58:37 PM:      Subkey fingerprint: 6A01 0C51 6600 6599 AA17  F081 46C2 130D FD24 97F5
9:58:37 PM: > GPG signature looks good
9:58:37 PM: > Extracting to ~/.yarn...
9:58:37 PM: > Adding to $PATH...
9:58:37 PM: > We've added the following to your /opt/buildhome/.profile
9:58:37 PM: > If this isn't the profile of your current shell then please add the following to your correct profile:
9:58:37 PM: export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
9:58:37 PM: 
9:58:37 PM: > Successfully installed Yarn 1.3.2! Please open another terminal where the `yarn` command will now be available.
9:58:38 PM: Installing NPM modules using Yarn version 1.3.2
9:58:39 PM: yarn install v1.3.2
9:58:39 PM: [1/4] Resolving packages...
9:58:42 PM: warning styled-components > [email protected]: New custom equality api does not play well with all equality helpers. Please use v5.x
9:58:48 PM: [2/4] Fetching packages...
9:59:16 PM: info [email protected]: The platform "linux" is incompatible with this module.
9:59:16 PM: info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
9:59:16 PM: [3/4] Linking dependencies...
9:59:17 PM: warning "gatsby > [email protected]" has incorrect peer dependency "graphql@^0.12.0 || ^0.13.0".
9:59:17 PM: warning "gatsby > [email protected]" has incorrect peer dependency "graphql@^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0".
9:59:17 PM: warning "gatsby > [email protected]" has incorrect peer dependency "graphql@^0.13.0".
9:59:42 PM: [4/4] Building fresh packages...
9:59:49 PM: success Saved lockfile.
9:59:49 PM: Done in 70.57s.
9:59:49 PM: NPM modules installed using Yarn
9:59:50 PM: Started restoring cached go cache
9:59:50 PM: Finished restoring cached go cache
9:59:50 PM: unset GOOS;
9:59:50 PM: unset GOARCH;
9:59:50 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.10.linux.amd64';
9:59:50 PM: export PATH="/opt/buildhome/.gimme/versions/go1.10.linux.amd64/bin:${PATH}";
9:59:50 PM: go version >&2;
9:59:50 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.10.linux.amd64.env';
9:59:50 PM: go version go1.10 linux/amd64
9:59:50 PM: Installing missing commands
9:59:50 PM: Verify run directory
9:59:50 PM: Executing user command: npm run build
9:59:51 PM: > [email protected] build /opt/build/repo/frontend
9:59:51 PM: > gatsby build
9:59:54 PM: success open and validate gatsby-configs โ€” 0.020 s
9:59:54 PM: success load plugins โ€” 0.313 s
9:59:55 PM: success onPreInit โ€” 0.674 s
9:59:55 PM: success delete html and css files from previous builds โ€” 0.009 s
9:59:55 PM: success initialize cache โ€” 0.015 s
9:59:55 PM: success copy gatsby files โ€” 0.053 s
9:59:55 PM: success onPreBootstrap โ€” 0.007 s
9:59:55 PM: The request failed with error code "ECONNREFUSED"
9:59:55 PM: error Plugin gatsby-source-wordpress returned an error
9:59:55 PM: 
9:59:55 PM:   TypeError: Cannot read property 'data' of undefined
9:59:55 PM:   
9:59:55 PM:   - fetch.js:145 
9:59:55 PM:     [frontend]/[gatsby-source-wordpress]/fetch.js:145:23
9:59:55 PM:   
9:59:55 PM:   - Generator.throw
9:59:55 PM:   
9:59:55 PM:   - util.js:16 tryCatcher
9:59:55 PM:     [frontend]/[bluebird]/js/release/util.js:16:23
9:59:55 PM:   
9:59:55 PM:   - promise.js:512 Promise._settlePromiseFromHandler
9:59:55 PM:     [frontend]/[bluebird]/js/release/promise.js:512:31
9:59:55 PM:   
9:59:55 PM:   - promise.js:569 Promise._settlePromise
9:59:55 PM:     [frontend]/[bluebird]/js/release/promise.js:569:18
9:59:55 PM:   
9:59:55 PM:   - promise.js:614 Promise._settlePromise0
9:59:55 PM:     [frontend]/[bluebird]/js/release/promise.js:614:10
9:59:55 PM:   
9:59:55 PM:   - promise.js:689 Promise._settlePromises
9:59:55 PM:     [frontend]/[bluebird]/js/release/promise.js:689:18
9:59:55 PM:   
9:59:55 PM:   - async.js:133 Async._drainQueue
9:59:55 PM:     [frontend]/[bluebird]/js/release/async.js:133:16
9:59:55 PM:   
9:59:55 PM:   - async.js:143 Async._drainQueues
9:59:55 PM:     [frontend]/[bluebird]/js/release/async.js:143:10
9:59:55 PM:   
9:59:55 PM:   - async.js:17 Immediate.Async.drainQueues
9:59:55 PM:     [frontend]/[bluebird]/js/release/async.js:17:14
9:59:55 PM:   
9:59:55 PM: 
9:59:55 PM: npm
9:59:55 PM:  ERR! code ELIFECYCLE
9:59:55 PM: npm ERR! errno 1
9:59:55 PM: npm ERR! [email protected] build: `gatsby build`
9:59:55 PM: npm ERR! Exit status 1
9:59:55 PM: npm ERR!
9:59:55 PM: npm ERR! Failed at the [email protected] build script.
9:59:55 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
9:59:55 PM: npm
9:59:55 PM:  ERR! A complete log of this run can be found in:
9:59:55 PM: npm ERR!     /opt/buildhome/.npm/_logs/2019-03-05T20_59_55_528Z-debug.log
9:59:55 PM: Caching artifacts
9:59:55 PM: Started saving node modules
9:59:55 PM: Finished saving node modules
9:59:55 PM: Started saving yarn cache
9:59:55 PM: Finished saving yarn cache
9:59:55 PM: Started saving pip cache
9:59:55 PM: Finished saving pip cache
9:59:55 PM: Started saving emacs cask dependencies
9:59:56 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
9:59:55 PM: Finished saving emacs cask dependencies
9:59:55 PM: Started saving maven dependencies
9:59:55 PM: Finished saving maven dependencies
9:59:55 PM: Started saving boot dependencies
9:59:55 PM: Finished saving boot dependencies
9:59:55 PM: Started saving go dependencies
9:59:55 PM: Finished saving go dependencies
9:59:56 PM: Cached node version v8.15.1
9:59:56 PM: Error running command: Build script returned non-zero exit code: 1
9:59:56 PM: Failing build: Failed to build site
9:59:56 PM: Finished processing build request in 1m33.920336421s
9:59:56 PM: Shutting down logging, 0 messages pending

Any reasoning to why this shouldn't work, when everything works locally? Is there another way to debug this in a better manner?

needs reproduction

Most helpful comment

Got it-thanks!

You won't be able to use your localhost variant of Wordpress when building in Netlify (because it won't be available!).

You'll want to swap this line with a hosted path to your Wordpress instance.

Going to close as answered, but please reply if we can help further and we'll re-open.

Thanks for using Gatsby ๐Ÿ’œ

All 4 comments

Do you have environment variables that are present locally but are not exposed via Netlify?

Could you provide a reproduction

@DSchau Thanks for replying this soon.

Quite frankly I'm kind of lost by what you mean when referring to environment variables:

I can just provide you with the current repo, I'll open it up for you in an instant.
https://github.com/omattman/djb

Got it-thanks!

You won't be able to use your localhost variant of Wordpress when building in Netlify (because it won't be available!).

You'll want to swap this line with a hosted path to your Wordpress instance.

Going to close as answered, but please reply if we can help further and we'll re-open.

Thanks for using Gatsby ๐Ÿ’œ

Got it-thanks!

You won't be able to use your localhost variant of Wordpress when building in Netlify (because it won't be available!).

You'll want to swap this line with a hosted path to your Wordpress instance.

Going to close as answered, but please reply if we can help further and we'll re-open.

Thanks for using Gatsby ๐Ÿ’œ

I clicked the link attached to this line but it doe nots take me to a line which has "localhost" instead it has useACF: true

I am totally lost and also having same problem

Mo

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timbrandin picture timbrandin  ยท  3Comments

andykais picture andykais  ยท  3Comments

dustinhorton picture dustinhorton  ยท  3Comments

3CordGuy picture 3CordGuy  ยท  3Comments

Oppenheimer1 picture Oppenheimer1  ยท  3Comments