**Describe the bug**
Beginning when I upgraded to Gatsby v4.6 I started getti…ng errors when building on Netlify. Most builds succeed, and then all of a sudden all builds fail. Sometimes clearing the cache fixes it, sometimes not. Now, a content change caused my production deploy to fail twice in a row.
I read that this might have been a regression, so I downgraded to 4.5, which fixed it initially but now build failures are happening again.
**Steps to reproduce**
Build gatsby site on netlify with v4.5 or v4.6
**Expected behavior**
A successful build.
**Configuration**
module.exports = {
flags: {
// FAST_DEV: true,
PRESERVE_FILE_DOWNLOAD_CACHE: true,
PARALLEL_SOURCING: true,
},
plugins: [
`gatsby-plugin-react-helmet`,
`gatsby-plugin-extract-schema`,
// {
// resolve: `gatsby-plugin-sharp`,
// options: { defaults: { placeholder: 'none', quality: 90 } },
// },
// `babel-plugin-remove-graphql-queries`, // for use with storybook
`gatsby-plugin-advanced-sitemap`,
// `gatsby-plugin-webpack-bundle-analyser-v3`,
// `gatsby-plugin-preload-link-crossorigin`,
// `gatsby-plugin-lint-queries`,
`gatsby-plugin-sharp`,
`babel-plugin-remove-graphql-queries`,
{
resolve: `gatsby-plugin-feed`,
options: {
query: `
{site {
siteMetadata {
title
description
siteUrl
site_url: siteUrl
}
}}`,
feeds: [
{
serialize: ({ query: { blog, site } }) => {
return blog.nodes.map(
({ title, date, slug, body, category, author }) => ({
title: title,
description: body.childMarkdownRemark.excerpt,
categories: [category],
author: author,
date: date,
url: site.siteMetadata.siteUrl + '/blog/' + slug,
guid: site.siteMetadata.siteUrl + '/blog/' + slug,
})
)
},
query: `
{
blog: allContentfulBlogPost(sort: { fields: [date], order: DESC }) {
nodes {
title
category
author{
name
}
date
slug
body {
childMarkdownRemark {
excerpt
}
}
}
}
}
`,
output: '/rss.xml',
title: 'Blog RSS',
},
],
},
},
{
resolve: `gatsby-theme-material-ui`,
options: {
webFontsConfig: null,
},
},
{
resolve: `gatsby-plugin-anchor-links`,
options: {
offset: -150,
},
},
{
resolve: 'gatsby-plugin-robots-txt',
options: {
sitemap: `${siteUrl}/sitemap/sitemap-pages.xml`,
resolveEnv: () => CONTEXT,
env: {
production: {
policy: [{ userAgent: '*' }],
},
'branch-deploy': {
policy: [
{ userAgent: '*', disallow: ['/'] },
{ userAgent: 'Algolia Crawler', allow: ['/'] },
],
},
'deploy-preview': {
policy: [
{ userAgent: '*', disallow: ['/'] },
{
userAgent: 'Algolia Crawler',
allow: ['/ # Algolia-Crawler-Verif: STRING'],
},
],
},
},
},
},
{
resolve: 'gatsby-plugin-intercom-spa',
options: {
app_id: GATSBY_INTERCOM_APP_ID,
include_in_development: true,
delay_timeout: 5000,
},
},
{
resolve: `gatsby-plugin-canonical-urls`,
options: {
siteUrl,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `images`,
path: `${__dirname}/src/`,
},
},
{
resolve: `gatsby-source-filesystem`,
options: {
name: `air_docs`,
path: `${__dirname}/docs/`,
},
},
{
resolve: 'gatsby-plugin-react-svg',
options: {
rule: {
include: /assets\/svg/,
},
},
},
{
resolve: `gatsby-transformer-sharp`,
},
{
resolve: `gatsby-transformer-inline-svg`,
},
{
resolve: `gatsby-plugin-image`,
},
{
resolve: `gatsby-plugin-manifest`,
options: {
// Details removed for privacy
cache_busting_mode: 'none',
crossOrigin: 'anonymous',
},
},
// this (optional) plugin enables Progressive Web App + Offline functionality
// To learn more, visit: https://gatsby.dev/offline
{
resolve: `gatsby-plugin-offline`,
},
// `gatsby-plugin-force-trailing-slashes`,
{
resolve: 'gatsby-source-contentful',
options: {
spaceId: CONTENTFUL_SPACE_ID,
accessToken: ACCESS_TOKEN,
},
},
{
resolve: 'gatsby-source-contentful',
options: {
spaceId: AIR_CONTENTFUL_SPACE_ID,
accessToken: AIR_ACCESS_TOKEN,
},
},
{
resolve: `gatsby-transformer-remark`,
options: {
plugins: [
{
resolve: `gatsby-remark-embed-video`,
options: {
width: 560,
height: 315,
related: false,
noIframeBorder: true,
},
},
{
resolve: `gatsby-remark-responsive-iframe`,
},
{
resolve: `gatsby-remark-images-contentful`,
options: {
maxWidth: 800,
withWebp: true,
linkImagesToOriginal: false,
sizeByPixelDensity: true,
},
},
{
resolve: `gatsby-remark-autolink-headers`,
options: {
icon: `<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg"> <circle cx="18" cy="18" r="18" fill="white"/> <path fill-rule="evenodd" clip-rule="evenodd" d="M16 23C16 23.6 15.6 24 15 24H12C8.7 24 6 21.3 6 18C6 14.7 8.7 12 12 12H15C15.6 12 16 12.4 16 13C16 13.6 15.6 14 15 14H12C9.8 14 8 15.8 8 18C8 20.2 9.8 22 12 22H15C15.6 22 16 22.4 16 23ZM24 12H21C20.4 12 20 12.4 20 13C20 13.6 20.4 14 21 14H24C26.2 14 28 15.8 28 18C28 20.2 26.2 22 24 22H21C20.4 22 20 22.4 20 23C20 23.6 20.4 24 21 24H24C27.3 24 30 21.3 30 18C30 14.7 27.3 12 24 12ZM14 19C13.4 19 13 18.6 13 18C13 17.4 13.4 17 14 17H22C22.6 17 23 17.4 23 18C23 18.6 22.6 19 22 19H14Z" fill="#363E50"/> </svg>`,
isIconAfterHeader: true,
enableCustomId: true,
elements: ['h1', 'h2', 'h3'],
offsetY: 100,
},
},
`gatsby-remark-prismjs`,
],
},
},
{
resolve: 'gatsby-plugin-preconnect',
options: {
domains: [
'https://www.google.com',
'https://googleads.g.doubleclick.net',
'https://www.google-analytics.com',
'https://www.googleadservices.com',
'https://www.googletagmanager.com',
],
},
},
{
resolve: `gatsby-plugin-gdpr-cookies`,
options: {
googleTagManager: {
trackingId: TAG_MANAGER_ID,
cookieName: 'gatsby-gdpr-google-tagmanager',
defaultDataLayer: { platform: 'gatsby' },
},
// only turn on when debugging
// environments: ['production', 'development'],
},
},
{
resolve: `gatsby-plugin-algolia`,
options: {
enablePartialUpdates: true,
appId: process.env.GATSBY_ALGOLIA_APP_ID,
apiKey: process.env.ALGOLIA_ADMIN_KEY,
queries,
chunkSize: 10000, // default: 1000
},
},
{
resolve: `gatsby-plugin-netlify`,
options: {
headers: {
'/**/*.html': [
'cache-control: public',
'cache-control: max-age=0',
'cache-control: must-revalidate',
],
'/page-data/*.json': [
'cache-control: public',
'cache-control: max-age=0',
'cache-control: must-revalidate',
],
'/app-data.json': [
'cache-control: public',
'cache-control: max-age=0',
'cache-control: must-revalidate',
],
'/static/*': [
'cache-control: public',
'cache-control: max-age=31536000',
'cache-control: immutable',
],
'/**/*.js': [
'cache-control: public',
'cache-control: max-age=3156000',
'cache-control: immutable',
],
'/**/*.css': [
'cache-control: public',
'cache-control: max-age=3156000',
'cache-control: immutable',
],
'/sw.js': [
'cache-control: public',
'cache-control: max-age=0',
'cache-control: must-revalidate',
],
},
},
},
**Environment**
Enter the following command in a terminal and copy/paste its output:
```bash
npx envinfo --system --binaries --browsers --npmPackages @netlify/plugin-gatsby
```
**Screenshots**
![image](https://user-images.githubusercontent.com/29257545/152428966-d6a9c792-a9c0-4b2b-a99e-f658b6eabb6b.png)
**Can you submit a pull request?**
No (don't know what the problem is)
Pull requests are welcome! If you would like to help us fix this bug, please
check our [contributions guidelines](../blob/master/CONTRIBUTING.md).