DSLC Slack: Debugging Netlify Deploys
Question #
Hi all! I’m having a hard time understanding why netlify checks on a Pull Request with only a empty line added in the commit are failing for a blogdown website. I created this PR as a small example, but basically any kind of PR is failing nevermind its content, and the site is published-rendered without problem if we commit directly to main.
I’m super puzzled by this, does anyone have any tips on how can I debug it? Thanks 🙏
- MC Nanton
Answer #
Let’s look through some of your Netlify deploy logs. I found these from your GitHub repo automated checks:
It seems like your PR deploy logs show this warning immediately before failing:
WARN 2024/12/10 21:35:19 Module "hugo-academic" is not compatible with this Hugo
version; run "hugo mod graph" for more information.
and this definitely doesn’t show up on your main deploy logs. Let’s try to figure out where your hugo versions are specified. Here’s a relevant section of the deploy logs:
4:35:19 PM: ❯ Current directory
4:35:19 PM: /opt/build/repo
4:35:19 PM:
4:35:19 PM: ❯ Config file
4:35:19 PM: /opt/build/repo/netlify.toml
4:35:19 PM:
4:35:19 PM: ❯ Context
4:35:19 PM: deploy-preview
The logs say that the file responsible for specifying hugo version is netlify.toml, so let’s have a look at what that looks like on GitHub right now:
[context.production.environment]
HUGO_VERSION = "0.64.0"
Notice that it specifies context.production
here, and that the context for the
failing logs is deploy-preview
. If we go back into the failing logs, we can confirm
that the hugo-version specified here isn’t working properly:
4:35:12 PM: Installing Hugo 0.57.2
So a solution that should work is to update the netlify.toml to specify the HUGO_VERSION for the deploy-preview context:
[context.production.environment]
HUGO_VERSION = "0.64.0"
[context.deploy-preview.environment]
HUGO_VERSION = "0.64.0"
and this should do the trick. You might need to push it to main instead of to a PR branch though, Netlify usually uses the config from the main repo branch.
(Update: this solution worked!)