We have an ongoing issue where identical Gatsby builds fail sometimes but work other times even when using your ‘Trigger deploy - Clear cache and build site’ button.
For example, both of these builds were triggered by the ‘Trigger deploy - Clear cache and build site’ button. The first one did not build correctly but the second one succeeded.
https://657f6bade9642c38c89d79b7--circuitartistmovingimage.netlify.app/ (Page Not Found)
https://657f890bff0bc248a9aadca2--circuitartistmovingimage.netlify.app/ (Built correctly)
This happens quite regularly and is a source of frustration for both the client and developers.
If you check the logs, you will see no errors were logged in the Building step of the failed deployment.
Please don’t ask me to read [Support Guide] I’ve deployed my site but I still see "Page not found” as none of that is relevant given the builds which fail and succeed are identical.
Thanks for getting in touch. I took a peek through the logs for both deploys, an while there definitely aren’t any errors in the logs of the deploy that didn’t publish the homepage, there are some warnings that potentially point to what the issue is:
The build runner did not run. Please change your build command to gatsby-runner and try again
Does this warning typically appear on deploys that get published without the home page? I’d recommend looking into removing this experimental build runner altogether and using the Netlify Image CDN to handle the image processing: GitHub - netlify/netlify-plugin-gatsby: A build plugin to integrate Gatsby seamlessly with Netlify. Let me know if this helps!
One other thing that we noticed that isn’t directly related to this issue were warnings due to the size of the functions bundle, e.g:
The function zip …/…/…/tmp/zisi-657f6bade9642c38c89d79b7/__ssr.zip size is 79.2 MB, which is larger than the recommended maximum size of 52.4 MB. This will fail the build if the unzipped size is bigger than the maximum size of 262 MB
You can take steps to reduce the size of the functions bundle by adding certain environment variables (
GATSBY_EXCLUDE_DATASTORE_FROM_BUNDLE) or excluding specific files from the bundle that you may not need. This will ensure that you don’t run into deploy failures down the road as a result of the bundle exceeding the size limit.
I added GATSBY_EXCLUDE_DATASTORE_FROM_BUNDLE=true to the environment variables but in the logs, it still complains about the size.
3:12:52 PM: Enabling Gatsby SSR support
3:12:52 PM: The function zip …/…/…/tmp/zisi-65b859a43824267f61887517/__ssr.zip size is 69.7 MB, which is larger than the recommended maximum size of 52.4 MB. This will fail the build if the unzipped size is bigger than the maximum size of 262 MB
However, in the table showing the largest files in the zip, it refers to pages which do not contain getServerData and therefore should be being generated using SSG.
We only have a single route which uses SSR so it’s not clear to me why Netlify is building other pages using SSR.
Can you shed any light?
Thanks for following up! Here it might be easiest to exclude any remaining problematic files from the bundle individually: Quote from “File-based configuration | Netlify Docs”. Let me know if this helps!