Gatsby: ERROR #95313 Building static HTML failed for path "/products/some-link"

Created on 20 May 2020  路  4Comments  路  Source: gatsbyjs/gatsby

Description

I'm trying to deploy project using Vercel but getting this error. I'm using createPages function for each product from Stripe and passing product to template where is error 'TypeError: Cannot read property 'product' of undefined'. Everything works as expected in dev mode but not in production
Describe the issue that you're seeing.

Steps to reproduce

Don't know right now

Expected result

Project should be deployed without errors.

Actual result

ERROR #95313

Environment

System:
OS: macOS 10.15.4
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 12.14.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.5 - /usr/local/bin/npm
Languages:
Python: 2.7.16 - /usr/bin/python
Browsers:
Chrome: 81.0.4044.138
Firefox: 76.0.1
Safari: 13.1
npmPackages:
gatsby: ^2.21.13 => 2.21.15
gatsby-cli: ^2.12.29 => 2.12.29
gatsby-image: ^2.4.1 => 2.4.2
gatsby-plugin-apollo: ^3.0.1 => 3.0.1
gatsby-plugin-manifest: ^2.4.2 => 2.4.2
gatsby-plugin-offline: ^3.2.1 => 3.2.1
gatsby-plugin-react-helmet: ^3.3.1 => 3.3.1
gatsby-plugin-react-redux: ^1.1.0-0 => 1.1.0-0
gatsby-plugin-sharp: ^2.6.1 => 2.6.1
gatsby-plugin-styled-components: ^3.3.1 => 3.3.1
gatsby-plugin-transition-link: ^1.18.0 => 1.18.0
gatsby-source-filesystem: ^2.3.1 => 2.3.1
gatsby-source-stripe: ^3.0.7 => 3.0.7
gatsby-transformer-sharp: ^2.5.1 => 2.5.1
npmGlobalPackages:
gatsby-cli: 2.12.1

Run gatsby info --clipboard in your project directory and paste the output here.

needs reproduction bug

Most helpful comment

Hi!

Sorry to hear you're running into an issue. Error 95313 just means that the HTML could not be built, which is goign to be down to a React error of some type. In this case it probably means that you have no product on that page. To stop the error immediately, add a null check for the object that is supposed to contain product. e.g:


export const MyComponent = ({ data }) => {
  if(!data) return null
 return <Something product={data.product} />
}

To help us best begin debugging the underlying cause, it would be really helpful if you're able to create a minimal reproduction. This is a simplified example of the issue that makes it clear and obvious what the issue is and how we can begin to debug it.

Thanks!

All 4 comments

Hi!

Sorry to hear you're running into an issue. Error 95313 just means that the HTML could not be built, which is goign to be down to a React error of some type. In this case it probably means that you have no product on that page. To stop the error immediately, add a null check for the object that is supposed to contain product. e.g:


export const MyComponent = ({ data }) => {
  if(!data) return null
 return <Something product={data.product} />
}

To help us best begin debugging the underlying cause, it would be really helpful if you're able to create a minimal reproduction. This is a simplified example of the issue that makes it clear and obvious what the issue is and how we can begin to debug it.

Thanks!

Your answer does not solve the problem. There's no way that page have no product because it was created by createPages function.

@jack0wsky Please note the previous request for a minimal reproduction. This will enable us to better help you resolve this issue. Thank you.

Hi. I'm going to close this now, as we can't do much to help without a reproduction. If you are able to create a minimal reproduction for this then please do reopen the issue. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

signalwerk picture signalwerk  路  3Comments

benstr picture benstr  路  3Comments

dustinhorton picture dustinhorton  路  3Comments

Oppenheimer1 picture Oppenheimer1  路  3Comments

jimfilippou picture jimfilippou  路  3Comments