Netlify site name: https://michaelmccarthy.netlify.app
Site GitHub repo: GitHub - mccarthy-m-g/michaelmccarthy: A place for myself
Hugo theme repo: GitHub - hugo-apero/hugo-apero: Apéro is a Hugo theme for personal websites. A Hugo theme you'll want to hang out with . This is the source for the theme files to install.
The problem
My Hugo site has been displaying a strange bug lately where random changes are being created to site content on deploy. Specifically, some content is not appearing on a page where it should. The behaviour is random in that if I manually trigger a deploy afterwards using “retry with latest branch commit” or “clear cache and retry with latest branch commit”, the content that did not appear on the first deploy will appear, but different content will disappear. I’ve found if I manually trigger a deploy enough times, eventually all the content that is supposed to be there will be.
This behaviour does not happen locally, so something must be happening on Netlify’s side. My local Hugo version and the one being used by Netlify are the same.
Any support is greatly appreciated, as I’m not sure how to debug this.
Additional details
In the Hugo theme I’m using, the content that is (dis)appearing is controlled by a boolean in the YAML for the page in question. The accompany partial (with the relevant lines highlighted) is here.
My guess is that something is occurring on Netlify’s side that randomly sets this boolean to false
for some pages when ranging over them, resulting in the HTML code with the missing content not being included in the deploy.
I’ve downloaded two successive deploys where this bug has occurred, which support this hypothesis. Unfortunately I’m a new user here so I can’t upload the files, but here’s what’s happening in the HTML code:
On the first deploy (deploy-63827b35538dbe0009a3cd09
), the following HTML code is absent on line 288 of project/index.html
:
<div class="ph0 ph2-m ph3-l">
<div class="aspect-ratio aspect-ratio--1x1 contain dim"style="background: url('https://michaelmccarthy.tidytales.ca/project/tidytales/featured-hex.png') center center no-repeat"><a href="https://michaelmccarthy.tidytales.ca/project/tidytales/" class="w-100 absolute top-0 bottom-0"></a></div>
</div>
On the second deploy (deploy-6382b68948c6557349f791b3
), the HTML code above is present where it should be, but the following is absent on line 192 of project/index.html
(even though this code was present in the first deploy):
<div class="ph0 ph2-m ph3-l">
<div class="aspect-ratio aspect-ratio--1x1 contain dim"style="background: url('https://michaelmccarthy.tidytales.ca/project/psyc-615-lab/featured-hex.png') center center no-repeat"><a href="https://michaelmccarthy.tidytales.ca/project/psyc-615-lab/" class="w-100 absolute top-0 bottom-0"></a></div>
</div>
For these deploys, this is the missing content in question that is controlled by the YAML boolean. To reiterate, nothing has changed between these two deploys; all I did was manually redeploy. The behaviour is random. If I manually redeploy enough times, eventually I land on a deploy where no HTML code is missing (and thus the content appears as it should).
Deploy logs
Deploy log 1 (deploy-63827b35538dbe0009a3cd09
)
12:46:47 PM: build-image version: 4c0c1cadee6a31c9bb8d824514030009c4c05c6a (focal)
12:46:47 PM: build-image tag: v4.15.0
12:46:47 PM: buildbot version: 8e21f3a6f94b4bf664f0a5ce69b751fdfc9791bd
12:46:47 PM: Fetching cached dependencies
12:46:47 PM: Starting to download cache of 294.9MB
12:46:49 PM: Finished downloading cache in 2.269531075s
12:46:49 PM: Starting to extract cache
12:46:50 PM: Finished extracting cache in 1.132754319s
12:46:50 PM: Finished fetching cache in 3.485783767s
12:46:50 PM: Starting to prepare the repo for build
12:46:51 PM: Preparing Git Reference refs/heads/main
12:46:51 PM: Parsing package.json dependencies
12:46:52 PM: Section completed: initializing
12:46:52 PM: Starting build script
12:46:52 PM: Installing dependencies
12:46:52 PM: Python version set to 2.7
12:46:52 PM: Started restoring cached node version
12:46:53 PM: Finished restoring cached node version
12:46:53 PM: v16.18.1 is already installed.
12:46:54 PM: Now using node v16.18.1 (npm v8.19.2)
12:46:54 PM: Enabling node corepack
12:46:54 PM: Started restoring cached build plugins
12:46:54 PM: Finished restoring cached build plugins
12:46:54 PM: Attempting ruby version 2.7.2, read from environment
12:46:54 PM: Using ruby version 2.7.2
12:46:55 PM: Using PHP version 8.0
12:46:55 PM: Installing Hugo 0.89.2
12:46:55 PM: hugo v0.89.2-63E3A5EB+extended linux/amd64 BuildDate=2021-11-08T15:22:24Z VendorInfo=gohugoio
12:46:55 PM: Started restoring cached go cache
12:46:55 PM: Finished restoring cached go cache
12:46:55 PM: Installing Go version 1.16.5 (requested 1.16.5)
12:46:59 PM: unset GOOS;
12:46:59 PM: unset GOARCH;
12:46:59 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.16.5.linux.amd64';
12:46:59 PM: export PATH="/opt/buildhome/.gimme/versions/go1.16.5.linux.amd64/bin:${PATH}";
12:46:59 PM: go version >&2;
12:46:59 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.16.5.linux.amd64.env"
12:46:59 PM: go version go1.16.5 linux/amd64
12:47:00 PM: Detected 0 framework(s)
12:47:00 PM: Installing missing commands
12:47:00 PM: Verify run directory
12:47:01 PM:
12:47:01 PM: ────────────────────────────────────────────────────────────────
12:47:01 PM: Netlify Build
12:47:01 PM: ────────────────────────────────────────────────────────────────
12:47:01 PM:
12:47:01 PM: ❯ Version
12:47:01 PM: @netlify/build 28.4.0
12:47:01 PM:
12:47:01 PM: ❯ Flags
12:47:01 PM: baseRelDir: true
12:47:01 PM: buildId: 63827b35538dbe0009a3cd07
12:47:01 PM: deployId: 63827b35538dbe0009a3cd09
12:47:01 PM: Creating deploy upload records
12:47:01 PM:
12:47:01 PM: ❯ Current directory
12:47:01 PM: /opt/build/repo
12:47:01 PM:
12:47:01 PM: ❯ Config file
12:47:01 PM: /opt/build/repo/netlify.toml
12:47:01 PM:
12:47:01 PM: ❯ Context
12:47:01 PM: production
12:47:01 PM:
12:47:01 PM: ────────────────────────────────────────────────────────────────
12:47:01 PM: 1. build.command from netlify.toml
12:47:01 PM: ────────────────────────────────────────────────────────────────
12:47:01 PM:
12:47:01 PM: $ hugo
12:47:01 PM: Start building sites …
12:47:01 PM: hugo v0.89.2-63E3A5EB+extended linux/amd64 BuildDate=2021-11-08T15:22:24Z VendorInfo=gohugoio
12:47:01 PM: | EN
12:47:01 PM: -------------------+-----
12:47:01 PM: Pages | 68
12:47:01 PM: Paginator pages | 0
12:47:01 PM: Non-page files | 24
12:47:01 PM: Static files | 98
12:47:01 PM: Processed images | 0
12:47:01 PM: Aliases | 3
12:47:01 PM: Sitemaps | 1
12:47:01 PM: Cleaned | 0
12:47:01 PM: Total in 231 ms
12:47:01 PM:
12:47:01 PM: (build.command completed in 264ms)
12:47:01 PM:
12:47:01 PM: ────────────────────────────────────────────────────────────────
12:47:01 PM: 2. Deploy site
12:47:03 PM: Starting post processing
12:47:01 PM: ────────────────────────────────────────────────────────────────
12:47:01 PM:
12:47:01 PM: Starting to deploy site from 'public'
12:47:01 PM: Creating deploy tree
12:47:02 PM: 45 new files to upload
12:47:03 PM: Post processing - HTML
12:47:02 PM: 0 new functions to upload
12:47:02 PM: Section completed: deploying
12:47:02 PM: Site deploy was successfully initiated
12:47:02 PM:
12:47:02 PM: (Deploy site completed in 1.1s)
12:47:02 PM:
12:47:02 PM: ────────────────────────────────────────────────────────────────
12:47:02 PM: Netlify Build Complete
12:47:02 PM: ────────────────────────────────────────────────────────────────
12:47:02 PM:
12:47:02 PM: (Netlify Build completed in 1.4s)
12:47:03 PM: Caching artifacts
12:47:03 PM: Started saving build plugins
12:47:03 PM: Finished saving build plugins
12:47:03 PM: Started saving pip cache
12:47:03 PM: Finished saving pip cache
12:47:03 PM: Started saving emacs cask dependencies
12:47:03 PM: Finished saving emacs cask dependencies
12:47:03 PM: Started saving maven dependencies
12:47:03 PM: Finished saving maven dependencies
12:47:03 PM: Started saving boot dependencies
12:47:03 PM: Finished saving boot dependencies
12:47:03 PM: Started saving rust rustup cache
12:47:03 PM: Finished saving rust rustup cache
12:47:03 PM: Started saving go dependencies
12:47:03 PM: Finished saving go dependencies
12:47:03 PM: Build script success
12:47:03 PM: Section completed: building
12:47:04 PM: Uploading Cache of size 294.7MB
12:47:05 PM: Post processing - header rules
12:47:05 PM: Post processing - redirect rules
12:47:05 PM: Post processing done
12:47:05 PM: Section completed: postprocessing
12:47:06 PM: Section completed: cleanup
12:47:06 PM: Finished processing build request in 19.397010138s
12:47:08 PM: Site is live ✨
Deploy log 2 (deploy-6382b68948c6557349f791b3
)
4:59:54 PM: build-image version: 4c0c1cadee6a31c9bb8d824514030009c4c05c6a (focal)
4:59:54 PM: build-image tag: v4.15.0
4:59:54 PM: buildbot version: 8e21f3a6f94b4bf664f0a5ce69b751fdfc9791bd
4:59:54 PM: Building without cache
4:59:54 PM: Starting to prepare the repo for build
4:59:54 PM: No cached dependencies found. Cloning fresh repo
4:59:54 PM: git clone https://github.com/mccarthy-m-g/michaelmccarthy
4:59:56 PM: Preparing Git Reference refs/heads/main
4:59:57 PM: Parsing package.json dependencies
4:59:57 PM: Section completed: initializing
4:59:58 PM: Starting build script
4:59:58 PM: Installing dependencies
4:59:58 PM: Python version set to 2.7
4:59:58 PM: v16.18.1 is already installed.
4:59:58 PM: Now using node v16.18.1 (npm v8.19.2)
4:59:58 PM: Enabling node corepack
4:59:58 PM: Started restoring cached build plugins
4:59:58 PM: Finished restoring cached build plugins
4:59:58 PM: Attempting ruby version 2.7.2, read from environment
4:59:59 PM: Using ruby version 2.7.2
4:59:59 PM: Using PHP version 8.0
4:59:59 PM: Installing Hugo 0.89.2
5:00:00 PM: hugo v0.89.2-63E3A5EB+extended linux/amd64 BuildDate=2021-11-08T15:22:24Z VendorInfo=gohugoio
5:00:00 PM: Started restoring cached go cache
5:00:00 PM: Finished restoring cached go cache
5:00:00 PM: Installing Go version 1.16.5 (requested 1.16.5)
5:00:04 PM: unset GOOS;
5:00:04 PM: unset GOARCH;
5:00:04 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.16.5.linux.amd64';
5:00:04 PM: export PATH="/opt/buildhome/.gimme/versions/go1.16.5.linux.amd64/bin:${PATH}";
5:00:04 PM: go version >&2;
5:00:04 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.16.5.linux.amd64.env"
5:00:04 PM: go version go1.16.5 linux/amd64
5:00:04 PM: Detected 0 framework(s)
5:00:04 PM: Installing missing commands
5:00:04 PM: Verify run directory
5:00:06 PM:
5:00:06 PM: ────────────────────────────────────────────────────────────────
5:00:06 PM: Netlify Build
5:00:06 PM: ────────────────────────────────────────────────────────────────
5:00:06 PM:
5:00:06 PM: ❯ Version
5:00:06 PM: @netlify/build 28.4.0
5:00:06 PM:
5:00:06 PM: ❯ Flags
5:00:06 PM: baseRelDir: true
5:00:06 PM: buildId: 6382b68948c6557349f791b1
5:00:06 PM: deployId: 6382b68948c6557349f791b3
5:00:06 PM:
5:00:06 PM: Creating deploy upload records
5:00:06 PM: ❯ Current directory
5:00:06 PM: /opt/build/repo
5:00:06 PM:
5:00:06 PM: ❯ Config file
5:00:06 PM: /opt/build/repo/netlify.toml
5:00:06 PM:
5:00:06 PM: ❯ Context
5:00:06 PM: production
5:00:06 PM:
5:00:06 PM: ────────────────────────────────────────────────────────────────
5:00:06 PM: 1. build.command from netlify.toml
5:00:06 PM: ────────────────────────────────────────────────────────────────
5:00:06 PM:
5:00:06 PM: $ hugo
5:00:07 PM: Starting post processing
5:00:06 PM: Start building sites …
5:00:06 PM: hugo v0.89.2-63E3A5EB+extended linux/amd64 BuildDate=2021-11-08T15:22:24Z VendorInfo=gohugoio
5:00:06 PM: | EN
5:00:07 PM: Post processing - HTML
5:00:06 PM: -------------------+-----
5:00:06 PM: Pages | 68
5:00:06 PM: Paginator pages | 0
5:00:06 PM: Non-page files | 24
5:00:06 PM: Static files | 98
5:00:06 PM: Processed images | 0
5:00:06 PM: Aliases | 3
5:00:06 PM: Sitemaps | 1
5:00:06 PM: Cleaned | 0
5:00:06 PM: Total in 241 ms
5:00:06 PM:
5:00:06 PM: (build.command completed in 271ms)
5:00:06 PM:
5:00:06 PM: ────────────────────────────────────────────────────────────────
5:00:06 PM: 2. Deploy site
5:00:06 PM: ────────────────────────────────────────────────────────────────
5:00:06 PM:
5:00:06 PM: Starting to deploy site from 'public'
5:00:06 PM: Creating deploy tree
5:00:06 PM: 4 new files to upload
5:00:06 PM: 0 new functions to upload
5:00:06 PM: Section completed: deploying
5:00:06 PM: Site deploy was successfully initiated
5:00:06 PM:
5:00:06 PM: (Deploy site completed in 549ms)
5:00:06 PM:
5:00:06 PM: ────────────────────────────────────────────────────────────────
5:00:06 PM: Netlify Build Complete
5:00:06 PM: ────────────────────────────────────────────────────────────────
5:00:06 PM:
5:00:06 PM: (Netlify Build completed in 840ms)
5:00:07 PM: Caching artifacts
5:00:08 PM: Post processing - header rules
5:00:07 PM: Started saving build plugins
5:00:07 PM: Finished saving build plugins
5:00:08 PM: Post processing - redirect rules
5:00:07 PM: Started saving pip cache
5:00:07 PM: Finished saving pip cache
5:00:07 PM: Started saving emacs cask dependencies
5:00:08 PM: Post processing done
5:00:07 PM: Finished saving emacs cask dependencies
5:00:07 PM: Started saving maven dependencies
5:00:07 PM: Finished saving maven dependencies
5:00:08 PM: Section completed: postprocessing
5:00:07 PM: Started saving boot dependencies
5:00:07 PM: Finished saving boot dependencies
5:00:07 PM: Started saving rust rustup cache
5:00:07 PM: Finished saving rust rustup cache
5:00:07 PM: Started saving go dependencies
5:00:07 PM: Finished saving go dependencies
5:00:08 PM: Build script success
5:00:08 PM: Section completed: building
5:00:09 PM: Uploading Cache of size 232.8MB
5:00:11 PM: Section completed: cleanup
5:00:11 PM: Finished processing build request in 16.642046768s
5:00:11 PM: Site is live ✨
Workarounds
As an aside, I know I can rewrite the partial in question to just include the HTML code without any If statement. I likely will as a stopgap measure, but would still like support to solve the bug at hand.