Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 301 Vote(s) - 3.46 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Netlify deploy with results of TypeError: Cannot read property 'data' of undefined

#1
I have completed my project using Wordpress as a headless CMS, this work locally; however when deploying to netlify I am getting cannot "TypeError: Cannot read property 'replace' of undefined"

The Error is referencing my node file, which is included below.



I have tried changing my config file, updating my packages, and have reviewed everything locally. Everything works fine locally, and my live server is up and running fine as well, I migrated my server prior to attempting to deploy.

Netlify Build Process and Error Log
```
2:14:44 PM: Build ready to start
2:14:47 PM: build-image version: 9e0f207a27642d0115b1ca97cd5e8cebbe492f63
2:14:47 PM: build-image tag: v3.3.2
2:14:47 PM: buildbot version: ef8d0929ed0baabafd8bbb7d0b021e1fc24180c0
2:14:47 PM: Fetching cached dependencies
2:14:47 PM: Starting to download cache of 255.0KB
2:14:47 PM: Finished downloading cache in 84.166898ms
2:14:47 PM: Starting to extract cache
2:14:47 PM: Failed to fetch cache, continuing with build
2:14:47 PM: Starting to prepare the repo for build
2:14:47 PM: No cached dependencies found. Cloning fresh repo
2:14:47 PM: git clone

[To see links please register here]

2:14:48 PM: Preparing Git Reference refs/heads/master
2:14:48 PM: Starting build script
2:14:48 PM: Installing dependencies
2:14:50 PM: Downloading and installing node v10.16.3...
2:14:51 PM: Downloading

[To see links please register here]

...
2:14:51 PM: 0
2:14:51 PM: .0%
2:14:51 PM: #
2:14:51 PM: #
2:14:51 PM: 3
2:14:51 PM: .
2:14:51 PM: 6
2:14:51 PM: %
2:14:51 PM: #
2:14:51 PM: #
2:14:51 PM: #
2:14:51 PM: #
2:14:51 PM: #
2:14:51 PM: #
2:14:51 PM: 9
2:14:51 PM: .
2:14:51 PM: 2
2:14:51 PM: %
2:14:51 PM: #
2:14:51 PM: #
2:14:51 PM: #
2:14:51 PM: #
2:14:51 PM: #
2:14:51 PM: #
2:14:51 PM: #
2:14:51 PM: #
2:14:51 PM: 12.4%
2:14:51 PM:
############
2:14:51 PM: 17.0%
2:14:52 PM:
##############
2:14:52 PM: 20.1%
2:14:52 PM:
################
2:14:52 PM: 22.4%
2:14:52 PM:
##################
2:14:52 PM: 26.3%
2:14:52 PM:
####################
2:14:52 PM: 28.9%
2:14:52 PM: #
2:14:52 PM: #
2:14:52 PM: #
2:14:52 PM: #
2:14:52 PM: #
2:14:52 PM: #
2:14:52 PM: #
2:14:52 PM: #
2:14:52 PM: #
2:14:52 PM: #
2:14:52 PM: #
2:14:52 PM: #
2:14:52 PM: #
2:14:52 PM: #
2:14:52 PM: #
2:14:52 PM: #
2:14:52 PM: #
2:14:52 PM: #
2:14:52 PM: #
2:14:52 PM: #
2:14:52 PM: #
2:14:52 PM: 3
2:14:52 PM: 0
2:14:52 PM: .
2:14:52 PM: 5
2:14:52 PM: %
2:14:52 PM:
######################
2:14:52 PM: # 32.0%
2:14:52 PM:
########################
2:14:52 PM: 33.4%
2:14:52 PM:
########################
2:14:52 PM: 34.5%
2:14:52 PM:
#########################
2:14:52 PM: 35.7%
2:14:53 PM:
#########################
2:14:53 PM: 36.1%
2:14:53 PM:
###########################
2:14:53 PM: 38.6%
2:14:53 PM:
############################
2:14:53 PM: 39.9%
2:14:53 PM:
#############################
2:14:53 PM: 41.6%
2:14:53 PM:
###############################
2:14:53 PM: 43.5%
2:14:53 PM:
################################
2:14:53 PM: 45.4%
2:14:53 PM:
#################################
2:14:53 PM: 47.1%
2:14:53 PM:
###################################
2:14:53 PM: 49.0%
2:14:53 PM:
####################################
2:14:53 PM: 50.9%
2:14:53 PM:
##################################### 52.3%
2:14:54 PM: #
2:14:54 PM: #
2:14:54 PM: #
2:14:54 PM: #
2:14:54 PM: ############
2:14:54 PM: #
2:14:54 PM: #################
2:14:54 PM: ####
2:14:54 PM: 5
2:14:54 PM: 3.6%
2:14:54 PM:
###########################
2:14:54 PM: ############ 55.3%
2:14:54 PM:
#########################################
2:14:54 PM: 57.0%
2:14:54 PM:
########################################## 58.8%
2:14:54 PM:
###########################################
2:14:54 PM: 60.7%
2:14:54 PM:
#############################################
2:14:54 PM: 62.8%
2:14:54 PM:
#############################################
2:14:54 PM: # 65.0%
2:14:54 PM:
################################################
2:14:54 PM: 67.3%
2:14:54 PM:
##################################################
2:14:54 PM: 70.5%
2:14:55 PM:
####################################################
2:14:55 PM: 73.2%
2:14:55 PM:
######################################################
2:14:55 PM: 76.1%
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: 7
2:14:55 PM: 9
2:14:55 PM: .
2:14:55 PM: 1
2:14:55 PM: %
2:14:55 PM:
###################################
2:14:55 PM: ######################## 82.2%
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #################### 85.6%
2:14:55 PM:
##########################
2:14:55 PM: #################################### 86.3%
2:14:55 PM:
#####################
2:14:55 PM: ############################################### 94.9%
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: ###################
2:14:55 PM: ######################## 97.6%
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: #
2:14:55 PM: ################################################################# 100.0%
2:14:56 PM: Computing checksum with sha256sum
2:14:56 PM: Checksums matched!
2:14:59 PM: Now using node v10.16.3 (npm v6.9.0)
2:14:59 PM: Attempting ruby version 2.6.2, read from environment
2:15:01 PM: Using ruby version 2.6.2
2:15:01 PM: Using PHP version 5.6
2:15:01 PM: Started restoring cached node modules
2:15:01 PM: Finished restoring cached node modules
2:15:01 PM: Installing NPM modules using NPM version 6.9.0
2:15:43 PM: > [email protected] install /opt/build/repo/node_modules/sharp
2:15:43 PM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
2:15:43 PM: info
2:15:43 PM: sharp
2:15:43 PM: Downloading

[To see links please register here]

2:15:46 PM: > [email protected] postinstall /opt/build/repo/node_modules/core-js
2:15:46 PM: > node scripts/postinstall || echo "ignore"
2:15:46 PM: Thank you for using core-js (

[To see links please register here]

) for polyfilling JavaScript standard library!
2:15:46 PM: The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
2:15:46 PM: >

[To see links please register here]

2:15:46 PM: >

[To see links please register here]

2:15:46 PM: Also, the author of core-js (

[To see links please register here]

) is looking for a good job -)
2:15:46 PM: > [email protected] postinstall /opt/build/repo/node_modules/core-js-pure
2:15:46 PM: > node scripts/postinstall || echo "ignore"
2:15:47 PM: Thank you for using core-js (

[To see links please register here]

) for polyfilling JavaScript standard library!
2:15:47 PM: The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
2:15:47 PM: >

[To see links please register here]

2:15:47 PM: >

[To see links please register here]

2:15:47 PM: Also, the author of core-js (

[To see links please register here]

) is looking for a good job -)
2:15:47 PM: > [email protected] postinstall /opt/build/repo/node_modules/gatsby-telemetry
2:15:47 PM: > node src/postinstall.js
2:15:47 PM: > [email protected] postinstall /opt/build/repo/node_modules/cwebp-bin
2:15:47 PM: > node lib/install.js
2:15:48 PM: ✔ cwebp pre-build test passed successfully
2:15:48 PM: > [email protected] postinstall /opt/build/repo/node_modules/mozjpeg
2:15:48 PM: > node lib/install.js
2:15:48 PM: ✔ mozjpeg pre-build test passed successfully
2:15:48 PM: > [email protected] postinstall /opt/build/repo/node_modules/pngquant-bin
2:15:48 PM: > node lib/install.js
2:15:49 PM: ✔ pngquant pre-build test passed successfully
2:15:49 PM: > [email protected] postinstall /opt/build/repo/node_modules/styled-components
2:15:49 PM: > node ./scripts/postinstall.js || exit 0
2:15:49 PM: Use styled-components at work? Consider supporting our development efforts at

[To see links please register here]

2:15:53 PM: npm WARN
2:15:53 PM: optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
2:15:53 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
2:15:53 PM: added 1883 packages from 1026 contributors and audited 31033 packages in 50.015s
2:15:53 PM: found 1 critical severity vulnerability
2:15:53 PM: run `npm audit fix` to fix them, or `npm audit` for details
2:15:53 PM: NPM modules installed
2:15:53 PM: Started restoring cached go cache
2:15:53 PM: Finished restoring cached go cache
2:15:54 PM: unset GOOS;
2:15:54 PM: unset GOARCH;
2:15:54 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
2:15:54 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
2:15:54 PM: go version >&2;
2:15:54 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
2:15:54 PM: go version go1.12 linux/amd64
2:15:54 PM: Installing missing commands
2:15:54 PM: Verify run directory
2:15:54 PM: Executing user command: gatsby build
2:15:58 PM: success open and validate gatsby-configs — 0.123
2:15:59 PM: success load plugins — 1.093
2:16:00 PM: success onPreInit — 0.020
2:16:00 PM: success delete html and css files from previous builds — 0.019
2:16:00 PM: success initialize cache — 0.018
2:16:00 PM: success copy gatsby files — 0.061
2:16:00 PM: success onPreBootstrap — 0.028
2:16:00 PM: info Creating GraphQL type definition for File
2:16:00 PM: The request failed with error code "ECONNREFUSED"
2:16:00 PM: error #11321 PLUGIN Cannot read property 'data' of undefined
2:16:00 PM: "gatsby-source-wordpress" threw an error while running the sourceNodes lifecycle:
2:16:00 PM: Cannot read property 'data' of undefined
2:16:00 PM: See our docs page for more info on this error:

[To see links please register here]

2:16:00 PM:
2:16:00 PM: TypeError: Cannot read property 'data' of undefined
2:16:00 PM:
2:16:00 PM: - fetch.js:141 fetch
2:16:00 PM: [repo]/[gatsby-source-wordpress]/fetch.js:141:21
2:16:00 PM:
2:16:00 PM: - next_tick.js:68 process._tickCallback
2:16:00 PM: internal/process/next_tick.js:68:7
2:16:00 PM:
2:16:00 PM:
2:16:00 PM: Skipping functions preparation step: no functions directory set
2:16:00 PM: Caching artifacts
2:16:00 PM: Started saving node modules
2:16:00 PM: Finished saving node modules
2:16:00 PM: Started saving pip cache
2:16:00 PM: Finished saving pip cache
2:16:00 PM: Started saving emacs cask dependencies
2:16:00 PM: Finished saving emacs cask dependencies
2:16:00 PM: Started saving maven dependencies
2:16:00 PM: Finished saving maven dependencies
2:16:00 PM: Started saving boot dependencies
2:16:00 PM: Finished saving boot dependencies
2:16:00 PM: Started saving go dependencies
2:16:00 PM: Finished saving go dependencies
2:16:04 PM: Error running command: Build script returned non-zero exit code: 1
2:16:04 PM: Failing build: Failed to build site
2:16:04 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
2:16:04 PM: Finished processing build request in 1m17.398214412s
```

Gatsby-Node.js
```
const _ = require(`lodash`)
const Promise = require(`bluebird`)
const path = require(`path`)
const slash = require(`slash`)

exports.createPages = ({ graphql, actions }) => {
const { createPage } = actions
// createRedirect({ fromPath: "/", toPath: "/home", redirectInBrowser: true, isPermanent: true })
return new Promise((resolve, reject) => {
// ==== PAGES (WORDPRESS NATIVE) ====
graphql(
`
{
allWordpressPage {
edges {
node {
id
slug
status
template
title
content
template
}
}
}
}
`,
)
.then(result => {
if (result.errors) {
console.log(result.errors)
reject(result.errors)
}

const pageTemplate = path.resolve("./src/templates/page.js")
const portfolioUnderContentTemplate = path.resolve("./src/templates/portfolioUnderContent.js")
_.each(result.data.allWordpressPage.edges, edge => {

createPage({
path: `/${edge.node.slug}/`,
component: slash(edge.node.template === "portfolio_under_content.php" ? portfolioUnderContentTemplate : pageTemplate),
context: edge.node,
})
})
})
// ==== END PAGES ====

// ==== PORTFOLIO ====
.then(() => {
graphql(
`
{
allWordpressWpPortfolio{
edges{
node{
id
title
slug
excerpt
content
featured_media{
source_url
}
acf{
portfolio_url
}
}
}
}
}
`,
).then(result => {
if (result.errors) {
console.log(result.errors)
reject(result.errors)
}
const portfolioTemplate = path.resolve("./src/templates/portfolio.js")
_.each(result.data.allWordpressWpPortfolio.edges, edge => {
createPage({
path: `/portfolio/${edge.node.slug}/`,
component: slash(portfolioTemplate),
context: edge.node,
})
})
})
})
// ==== END PORTFOLIO ====
// ==== BLOG POSTS ====
.then(() => {
graphql(`
{
allWordpressPost{
edges{
node{
excerpt
wordpress_id
date(formatString: "Do MMM YYYY HH:mm")
title
content
slug
}
}
}
}
`).then(result => {
if (result.errors) {
console.log(result.errors)
reject(result.errors)
}

const posts = result.data.allWordpressPost.edges
const postsPerPage = 2
const numberOfPages = Math.ceil(posts.length / postsPerPage)
const blogPostListTemplate = path.resolve("./src/templates/blogPostList.js")

Array.from({ length: numberOfPages }).forEach((page, index) => {
createPage({
component: slash(blogPostListTemplate),
path: index === 0 ? "/blog" : `/blog/${index + 1}`,
context: {
posts: posts.slice(index * postsPerPage, (index * postsPerPage) + postsPerPage),
numberOfPages,
currentPage: index + 1,
},
})
})

const pageTemplate = path.resolve("./src/templates/page.js")
_.each(posts, (post) => {
createPage({
path: `/post/${post.node.slug}`,
component: slash(pageTemplate),
context: post.node,
})
})

resolve()
})
})
})
}
```


Gatsby-Config.js
```
require('dotenv').config({
path:'.env'
})

module.exports = {
siteMetadata: {
title: `Gatsby Default Starter`,
description: `Kick off your next, great Gatsby project with this default starter. This barebones starter ships with the main Gatsby configuration files you might need.`,
author: `@gatsbyjs`,
},
plugins: [
`gatsby-plugin-styled-components`,
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/images`,
},
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `gatsby-starter-default`,
short_name: `starter`,
start_url: `/`,
background_color: `#663399`,
theme_color: `#663399`,
display: `minimal-ui`,
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
},
},
{
resolve: "gatsby-source-wordpress",
options: {

baseUrl: process.env.API_URL,
protocol: process.env.API_PROTOCOL,
hostingWPCOM: false,
useACF: true,
acfOptionPageIds: [],
auth: {
htaccess_user: "your-htaccess-username",
htaccess_pass: "your-htaccess-password",
htaccess_sendImmediately: false,
wpcom_app_clientSecret: process.env.WORDPRESS_CLIENT_SECRET,
wpcom_app_clientId: "54793",
wpcom_user: "[email protected]",
wpcom_pass: process.env.WORDPRESS_PASSWORD,
jwt_user: process.env.JWT_USER,
jwt_pass: process.env.JWT_PASSWORD,
jwt_base_path: "/jwt-auth/v1/token",
},
cookies: {},
verboseOutput: false,
perPage: 100,
searchAndReplaceContentUrls: {
sourceUrl: "https://source-url.com",
replacementUrl: "https://replacement-url.com",
},
concurrentRequests: 10,
includedRoutes: [
"**/*/*/categories",
"**/*/*/posts",
"**/*/*/pages",
"**/*/*/media",
"**/*/*/tags",
"**/*/*/taxonomies",
"**/*/*/users",
"**/*/*/menus",
"**/*/*/portfolio",
],
excludedRoutes: [],
normalizer: function({ entities }) {
return entities
},
},
},
'gatsby-plugin-netlify'
],
}
```

Package.json
```
{
"name": "gatsby-starter-default",
"private": true,
"description": "A simple starter to get up and developing quickly with Gatsby",
"version": "0.1.0",
"author": "Kyle Mathews <[email protected]>",
"dependencies": {
"@material-ui/core": "^4.3.0",
"babel-plugin-styled-components": "^1.10.6",
"gatsby": "^2.13.45",
"gatsby-image": "^2.2.7",
"gatsby-plugin-manifest": "^2.2.4",
"gatsby-plugin-netlify": "^2.1.3",
"gatsby-plugin-offline": "^2.2.4",
"gatsby-plugin-react-helmet": "^3.1.2",
"gatsby-plugin-sharp": "^2.2.9",
"gatsby-plugin-styled-components": "^3.1.2",
"gatsby-source-filesystem": "^2.1.7",
"gatsby-source-wordpress": "^3.1.12",
"gatsby-transformer-sharp": "^2.2.5",
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-dom": "^16.9.0",
"react-grid-system": "^4.4.11",
"react-helmet": "^5.2.1",
"styled-components": "^4.3.2"
},
"devDependencies": {
"prettier": "^1.18.2"
},
"keywords": [
"gatsby"
],
"license": "MIT",
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write src/**/*.{js,jsx}",
"start": "npm run develop",
"serve": "gatsby serve",
"test": "echo \"Write tests! ->

[To see links please register here]

;
},
"repository": {
"type": "git",
"url": "https://github.com/gatsbyjs/gatsby-starter-default"
},
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
}
}
```

I need to know where I messed up so that I can get this fixed and deployed.

any insight into my error and how to correct it will be greatly appreciated.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through