Gatsby site deploy failed

Hi! I´m having a problem deploying a site created on gatsby. Started from a template, modified it and with ‘gatsby develop’ on local seems to work fine, but when I link the site from github to netlify and try to deploy I get this error:

error “gatsby-transformer-yaml” threw an error while running the onCreateNode lifecycle

The error itself seems to be with gatsby-transformer-yaml and a null property that it cannot read.

The deploy settings are set as following:

Base directory: Not set

Build command: gatsby build

Publish directory: public/

Builds: Active

Do yo know what might be the problem here? I might be missing important points because i´m not very experienced with Gatsby. If you need more information about the issue please let me know.

Thanks!

hmm, as this issue seems to be coming from gatsby itself, there are few things we can check.

Can you post the full build log also, please?

  • clear cache and redeploy, maybe gatsby’s dependencies didn’t download correctly
  • are you committing your package-lock file? it could be that there is some minor version conflict between the working config on your local machine and what we end up recreating on our server
  • is it a case issue (seems unlikely)

Thanks for the reply!

I´m going to check the posible solutions you gave me. In the meantime, here is the full build log:

9:44:42 PM: Build ready to start
9:44:44 PM: build-image version: 342853e31ef590be8195dfbea64bbc4657de7b6b
9:44:44 PM: build-image tag: v3.3.16
9:44:44 PM: buildbot version: 0ffb969a1fc5a7aa9d2a93dd77dd40a990576807
9:44:44 PM: Fetching cached dependencies
9:44:44 PM: Starting to download cache of 254.3KB
9:44:44 PM: Finished downloading cache in 72.579345ms
9:44:44 PM: Starting to extract cache
9:44:44 PM: Failed to fetch cache, continuing with build
9:44:44 PM: Starting to prepare the repo for build
9:44:45 PM: No cached dependencies found. Cloning fresh repo
9:44:45 PM: git clone https://github.com/shermi11/gf-photo
9:44:47 PM: Preparing Git Reference refs/heads/master
9:44:49 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: ‘public’ versus ‘public/’ in the Netlify UI
9:44:49 PM: Starting build script
9:44:49 PM: Installing dependencies
9:44:49 PM: Python version set to 2.7
9:44:50 PM: v12.18.0 is already installed.
9:44:51 PM: Now using node v12.18.0 (npm v6.14.4)
9:44:51 PM: Started restoring cached build plugins
9:44:51 PM: Finished restoring cached build plugins
9:44:51 PM: Attempting ruby version 2.7.1, read from environment
9:44:52 PM: Using ruby version 2.7.1
9:44:53 PM: Using PHP version 5.6
9:44:53 PM: 5.2 is already installed.
9:44:53 PM: Using Swift version 5.2
9:44:53 PM: Started restoring cached node modules
9:44:53 PM: Finished restoring cached node modules
9:44:53 PM: Installing NPM modules using NPM version 6.14.4
9:45:21 PM: npm WARN tarball tarball data for typescript@3.9.3 (sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==) seems to be corrupted. Trying one more time.
9:46:03 PM: > sharp@0.25.3 install /opt/build/repo/node_modules/sharp
9:46:03 PM: > (node install/libvips && node install/dll-copy && prebuild-install --runtime=napi) || (node-gyp rebuild && node install/dll-copy)
9:46:03 PM: info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.9.1/libvips-8.9.1-linux-x64.tar.gz
9:46:06 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/bmp/node_modules/core-js
9:46:06 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:06 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/core/node_modules/core-js
9:46:06 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:06 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/custom/node_modules/core-js
9:46:06 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:06 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/gif/node_modules/core-js
9:46:06 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:06 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/jpeg/node_modules/core-js
9:46:06 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:06 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-blit/node_modules/core-js
9:46:06 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:06 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-blur/node_modules/core-js
9:46:06 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:06 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-circle/node_modules/core-js
9:46:06 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:06 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-color/node_modules/core-js
9:46:06 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:06 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-contain/node_modules/core-js
9:46:06 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:06 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-cover/node_modules/core-js
9:46:06 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:06 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-crop/node_modules/core-js
9:46:06 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:06 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-displace/node_modules/core-js
9:46:06 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:07 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-dither/node_modules/core-js
9:46:07 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:07 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-fisheye/node_modules/core-js
9:46:07 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:07 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-flip/node_modules/core-js
9:46:07 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:07 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-gaussian/node_modules/core-js
9:46:07 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:07 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-invert/node_modules/core-js
9:46:07 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:07 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-mask/node_modules/core-js
9:46:07 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:07 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-normalize/node_modules/core-js
9:46:07 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:07 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-print/node_modules/core-js
9:46:07 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:07 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-resize/node_modules/core-js
9:46:07 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:07 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-rotate/node_modules/core-js
9:46:07 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:07 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-scale/node_modules/core-js
9:46:07 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:07 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-shadow/node_modules/core-js
9:46:07 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:07 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugin-threshold/node_modules/core-js
9:46:07 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:08 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/plugins/node_modules/core-js
9:46:08 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:08 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/png/node_modules/core-js
9:46:08 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:08 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/tiff/node_modules/core-js
9:46:08 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:08 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/types/node_modules/core-js
9:46:08 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:08 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/@jimp/utils/node_modules/core-js
9:46:08 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:08 PM: > core-js@2.6.11 postinstall /opt/build/repo/node_modules/core-js
9:46:08 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:08 PM: > core-js-pure@3.6.5 postinstall /opt/build/repo/node_modules/core-js-pure
9:46:08 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:09 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/jimp/node_modules/core-js
9:46:09 PM: > node -e “try{require(‘./postinstall’)}catch(e){}”
9:46:09 PM: > gatsby-telemetry@1.3.9 postinstall /opt/build/repo/node_modules/gatsby-telemetry
9:46:09 PM: > node src/postinstall.js || true
9:46:10 PM: > cwebp-bin@5.1.0 postinstall /opt/build/repo/node_modules/cwebp-bin
9:46:10 PM: > node lib/install.js
9:46:10 PM: :heavy_check_mark: cwebp pre-build test passed successfully
9:46:10 PM: > mozjpeg@6.0.1 postinstall /opt/build/repo/node_modules/mozjpeg
9:46:10 PM: > node lib/install.js
9:46:11 PM: :heavy_check_mark: mozjpeg pre-build test passed successfully
9:46:11 PM: > pngquant-bin@5.0.2 postinstall /opt/build/repo/node_modules/pngquant-bin
9:46:11 PM: > node lib/install.js
9:46:11 PM: :heavy_check_mark: pngquant pre-build test passed successfully
9:46:11 PM: > cypress@4.6.0 postinstall /opt/build/repo/node_modules/cypress
9:46:11 PM: > node index.js --exec install
9:46:12 PM: Installing Cypress (version: 4.6.0)
9:46:12 PM: [00:46:12] Downloading Cypress [started]
9:46:14 PM: [00:46:14] Downloading Cypress [completed]
9:46:14 PM: [00:46:14] Unzipping Cypress [started]
9:46:25 PM: [00:46:25] Unzipping Cypress [completed]
9:46:25 PM: [00:46:25] Finishing Installation [started]
9:46:25 PM: [00:46:25] Finishing Installation [completed]
9:46:26 PM:
9:46:26 PM: You can now open Cypress by running: node_modules/.bin/cypress open
9:46:26 PM: Installing Cypress | Cypress Documentation
9:46:26 PM:
9:46:26 PM: > gatsby-cli@2.12.34 postinstall /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli
9:46:26 PM: > node scripts/postinstall.js
9:46:26 PM: > gatsby@2.22.9 postinstall /opt/build/repo/node_modules/gatsby
9:46:26 PM: > node scripts/postinstall.js
9:46:29 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/fsevents):
9:46:29 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
9:46:29 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/chokidar/node_modules/fsevents):
9:46:29 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
9:46:29 PM: added 2427 packages from 1398 contributors and audited 2444 packages in 95.288s
9:46:32 PM: 140 packages are looking for funding
9:46:32 PM: run npm fund for details
9:46:32 PM: found 0 vulnerabilities
9:46:32 PM: NPM modules installed
9:46:32 PM: Started restoring cached go cache
9:46:32 PM: Finished restoring cached go cache
9:46:32 PM: go version go1.14.4 linux/amd64
9:46:32 PM: go version go1.14.4 linux/amd64
9:46:32 PM: Installing missing commands
9:46:32 PM: Verify run directory
9:46:33 PM: ​
9:46:33 PM: ┌─────────────────────────────┐
9:46:33 PM: │ Netlify Build │
9:46:33 PM: └─────────────────────────────┘
9:46:33 PM: ​
9:46:33 PM: ❯ Version
9:46:33 PM: @netlify/build 2.0.10
9:46:33 PM: ​
9:46:33 PM: ❯ Flags
9:46:33 PM: deployId: 5eeab8fa9b3e0bc045e8092e
9:46:33 PM: mode: buildbot
9:46:33 PM: ​
9:46:33 PM: ❯ Current directory
9:46:33 PM: /opt/build/repo
9:46:33 PM: ​
9:46:33 PM: ❯ Config file
9:46:33 PM: No config file was defined: using default values.
9:46:33 PM: ​
9:46:33 PM: ❯ Context
9:46:33 PM: production
9:46:33 PM: ​
9:46:33 PM: ┌────────────────────────────────┐
9:46:33 PM: │ 1. Build command from settings │
9:46:33 PM: └────────────────────────────────┘
9:46:33 PM: ​
9:46:33 PM: $ gatsby build
9:46:36 PM: success open and validate gatsby-configs - 0.062s
9:46:37 PM: success load plugins - 1.187s
9:46:37 PM: success onPreInit - 0.017s
9:46:37 PM: success delete html and css files from previous builds - 0.012s
9:46:37 PM: success initialize cache - 0.007s
9:46:37 PM: success copy gatsby files - 0.044s
9:46:37 PM: success onPreBootstrap - 0.009s
9:46:37 PM: success createSchemaCustomization - 0.004s
9:46:37 PM: error “gatsby-transformer-yaml” threw an error while running the onCreateNode lifecycle:
9:46:37 PM: Cannot read property ‘id’ of null
9:46:37 PM: 67 | if (_.isArray(parsedContent)) {
9:46:37 PM: 68 | parsedContent.forEach((obj, i) => {
9:46:37 PM: > 69 | transformObject(obj, obj.id ? obj.id : createNodeId(${node.id} [${i}] >>> YAML), getType({
9:46:37 PM: | ^
9:46:37 PM: 70 | node,
9:46:37 PM: 71 | object: obj,
9:46:37 PM: 72 | isArray: true
9:46:37 PM:
9:46:37 PM:
9:46:37 PM: TypeError: Cannot read property ‘id’ of null
9:46:37 PM:
9:46:37 PM: - gatsby-node.js:69
9:46:37 PM: [repo]/[gatsby-transformer-yaml]/gatsby-node.js:69:32
9:46:37 PM:
9:46:37 PM: - Array.forEach
9:46:37 PM:
9:46:37 PM: - gatsby-node.js:68 Object.onCreateNode
9:46:37 PM: [repo]/[gatsby-transformer-yaml]/gatsby-node.js:68:19
9:46:37 PM:
9:46:37 PM:
9:46:37 PM: not finished source and transform nodes - 0.384s
9:46:37 PM: ​
9:46:37 PM: ┌─────────────────────────────┐
9:46:37 PM: │ “build.command” failed │
9:46:37 PM: └─────────────────────────────┘
9:46:37 PM: ​
9:46:37 PM: Error message
9:46:37 PM: Command failed with exit code 1: gatsby build
9:46:37 PM: ​
9:46:37 PM: Error location
9:46:37 PM: In Build command from settings:
9:46:37 PM: gatsby build
9:46:37 PM: ​
9:46:37 PM: Resolved config
9:46:37 PM: build:
9:46:37 PM: command: gatsby build
9:46:37 PM: publish: /opt/build/repo/public
9:46:37 PM: Caching artifacts
9:46:37 PM: Started saving node modules
9:46:37 PM: Finished saving node modules
9:46:37 PM: Started saving build plugins
9:46:38 PM: Finished saving build plugins
9:46:38 PM: Started saving pip cache
9:46:42 PM: Finished saving pip cache
9:46:42 PM: Started saving emacs cask dependencies
9:46:42 PM: Finished saving emacs cask dependencies
9:46:42 PM: Started saving maven dependencies
9:46:42 PM: Finished saving maven dependencies
9:46:42 PM: Started saving boot dependencies
9:46:43 PM: Finished saving boot dependencies
9:46:43 PM: Started saving go dependencies
9:46:43 PM: Finished saving go dependencies
9:46:45 PM: Error running command: Build script returned non-zero exit code: 1
9:46:45 PM: Failing build: Failed to build site
9:46:45 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1
9:46:45 PM: Finished processing build request in 2m1.144169808s

Update: I now think the problem is some file missing in the repository, because when I download the repository from github to check it on local I get the same error (having previously installed all the dependencies with npm install).
Is it possible that the problem is coming from a file that the repository doesnt get with .gitignore?
Because the build in the local version (not the repository) its working fine. Here´s the content of the .gitignore file:

Logs

logs

*.log

npm-debug.log*

yarn-debug.log*

yarn-error.log*

Runtime data

pids

*.pid

*.seed

*.pid.lock

Directory for instrumented libs generated by jscoverage/JSCover

lib-cov

Coverage directory used by tools like istanbul

coverage

nyc test coverage

.nyc_output

Grunt intermediate storage (Creating plugins - Grunt: The JavaScript Task Runner)

.grunt

Bower dependency directory (https://bower.io/)

bower_components

node-waf configuration

.lock-wscript

Compiled binary addons (C++ addons | Node.js v21.2.0 Documentation)

build/Release

Dependency directories

node_modules/

jspm_packages/

Typescript v1 declaration files

typings/

Optional npm cache directory

.npm

Optional eslint cache

.eslintcache

Optional REPL history

.node_repl_history

Output of ‘npm pack’

*.tgz

Yarn Integrity file

.yarn-integrity

dotenv environment variables file

#.env

#.env.*

.cache/

public

results

yarn-error.log

.idea

.vscode

cypress/e2e/build

.DS_Store

hey there,

the error is coming from here:

9:46:37 PM:
9:46:37 PM: TypeError: Cannot read property ‘id’ of null
9:46:37 PM:
9:46:37 PM: - gatsby-node.js:69
9:46:37 PM: [repo]/[gatsby-transformer-yaml]/gatsby-node.js:69:32

so this id is seemingly null. I can’t exactly say why.

do you have some information in an .env file that is maybe not making it to the server?
did you commit and push your package.lock file from a working local setup?

hey perry! thanks for the answer.

After investigating the error a little further, I found that the problem is not from netlify but gatsby itself, so thanks in advance for answering to an issue that doesn´t belongs here! (posted here first because I thought that it was netlify´s).

It runs fine on local, but when I send it to a repository (.gitignore included) the error appears again. I have a .env file but commited it, it has the business ID and the acces token (its for an instagram feed). Blind guessing, it might be something that stayed in the cache on local, or some file that the .gitignore doesn´t send. About that package.lock, i´ve commited it first but erased it, having the same result.

ah! instagram!

if you run a quick search here in the forums for “instagram” you will see a few other folks who also posted about trying to get data from the instagram api. maybe one of those threads will contain some answers?

I will be looking for that, huge thanks for the support!

1 Like

good luck. if i see anything useful for you, i’ll definitely post it here :slight_smile: