Skip to main content

DSLC Slack: Debugging Netlify Deploys

·2 mins
dslc-slack q-a r-in-production r
I greatly enjoy the DSLC Slack Community ( dslc.io/join), and spend a fair bit of time answering questions! This post is part of a series where I curate some interesting questions and/or answers that I’ve come across there.

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:

editor’s note: archived the deploy logs in question to this gist just in case the deploy logs are deleted at some point

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!)

Related

DSLC Slack: Changing Window Titles in Shiny
·1 min
dslc-slack q-a shiny r
Pairing a snippet of JavaScript with Shiny reactivity to dynamically change the window title
DSLC Slack: Explaining Shiny to Your IT Team
·6 mins
dslc-slack q-a shiny r
Helping present the business architecture for Shiny in production to a relatively technical (but not R-based) crowd
Effective Logging Strategies
·1 min
talks r-in-production shiny videos r
A talk given at Jumping Rivers’ Shiny in Production 2023 conference on effective logging strategies for R and Shiny.