My build is failing

The build also fails locally

3:03:15 PM: Fetch Contentful data: 284.578ms
3:03:15 PM: error “gatsby-node.js” threw an error while running the onCreateNode lifecycle:
3:03:15 PM: Cannot read property ‘replace’ of undefined
3:03:15 PM: 25 | const { createNodeField } = actions;
3:03:15 PM: 26 | if (node.internal.type === ‘MarkdownRemark’) {
3:03:15 PM: > 27 | const slug = createFilePath({ node, getNode, basePath: ‘content’ });
3:03:15 PM: | ^
3:03:15 PM: 28 | createNodeField({
3:03:15 PM: 29 | node,
3:03:15 PM: 30 | name: ‘slug’,
**3:03:15 PM: **
3:03:15 PM: TypeError: Cannot read property ‘replace’ of undefined
**3:03:15 PM: **
3:03:15 PM: - path.js:54 slash
3:03:15 PM: [repo]/[gatsby-core-utils]/dist/path.js:54:15
**3:03:15 PM: **
3:03:15 PM: - create-file-path.js:41 module.exports
3:03:15 PM: [repo]/[gatsby-source-filesystem]/create-file-path.js:41:61
**3:03:15 PM: **
3:03:15 PM: - gatsby-node.js:27 Object.exports.onCreateNode
3:03:15 PM: /opt/build/repo/gatsby-node.js:27:18
**3:03:15 PM: **
3:03:15 PM: - api-runner-node.js:247 runAPI
3:03:15 PM: [repo]/[gatsby]/dist/utils/api-runner-node.js:247:41
**3:03:15 PM: **
3:03:15 PM: - api-runner-node.js:387 resolve
3:03:15 PM: [repo]/[gatsby]/dist/utils/api-runner-node.js:387:13
**3:03:15 PM: **
3:03:15 PM: - new Promise
**3:03:15 PM: **
3:03:15 PM: - api-runner-node.js:386 runPlugin
3:03:15 PM: [repo]/[gatsby]/dist/utils/api-runner-node.js:386:10
**3:03:15 PM: **
3:03:15 PM: - api-runner-node.js:340 module.exports
3:03:15 PM: [repo]/[gatsby]/dist/utils/api-runner-node.js:340:24
**3:03:15 PM: **
3:03:15 PM: - next_tick.js:68 process._tickCallback
3:03:15 PM: internal/process/next_tick.js:68:7
**3:03:15 PM: **
3:03:15 PM:
3:03:15 PM: not finished source and transform nodes - 0.531s
3:03:15 PM: Skipping functions preparation step: no functions directory set
3:03:15 PM: Caching artifacts
3:03:15 PM: Started saving node modules
3:03:15 PM: Finished saving node modules
3:03:15 PM: Started saving pip cache
3:03:15 PM: Finished saving pip cache
3:03:15 PM: Started saving emacs cask dependencies
3:03:15 PM: Finished saving emacs cask dependencies
3:03:15 PM: Started saving maven dependencies
3:03:15 PM: Finished saving maven dependencies
3:03:15 PM: Started saving boot dependencies
3:03:15 PM: Finished saving boot dependencies
3:03:15 PM: Started saving go dependencies
3:03:15 PM: Finished saving go dependencies
3:03:19 PM: Error running command: Build script returned non-zero exit code: 1
3:03:19 PM: Failing build: Failed to build site
3:03:19 PM: failed during stage ‘building site’: Build script returned non-zero exit code: 1
3:03:19 PM: Finished processing build request in 1m24.387006522s

Hi, @billp72, our support team cannot troubleshoot custom code - only Netlify specific issues. That being said, it is possible someone else here on our community site will have a solution for the local build issue.

Note, if the local build was successful and builds at Netlify were not working, then our support team can troubleshoot this.

However, if the local build isn’t working, that is custom code (not Netlify code) and therefore isn’t something our support team can assist with because it is outside of our support scope.

If there are Netlify specific issues or questions, please let us know.

No worries. I figured it out. If i have any other problems, ill use the community.

Thanks, Bill