nicokaiser / hugo-theme-gallery

Gallery Theme for Hugo
https://nicokaiser.github.io/hugo-theme-gallery/
MIT License
305 stars 85 forks source link

CloudFlare erroring on site build #76

Closed thackmaster closed 1 month ago

thackmaster commented 1 month ago

I can't get CloudFlare Pages to build after I add content to the site, although I can locally on my Mac.

The first build I pushed was immediately after I had followed the directions in the README.md, modified the hugo.toml file, and created the go.mod file, which published fine at https://8a8d1162.site-6p1.pages.dev/ with the following log file:

2024-07-21T14:47:22.608222Z Cloning repository...
2024-07-21T14:47:23.197742Z From https://github.com/thackmaster/site
2024-07-21T14:47:23.198213Z  * branch            68cb8afe0566a41c2bb2f863a67f9bf61d7e0c3f -> FETCH_HEAD
2024-07-21T14:47:23.198313Z 
2024-07-21T14:47:23.231569Z HEAD is now at 68cb8af reinit
2024-07-21T14:47:23.231908Z 
2024-07-21T14:47:23.81303Z  Submodule 'themes/gallery' (https://github.com/nicokaiser/hugo-theme-gallery.git) registered for path 'themes/gallery'
2024-07-21T14:47:23.813513Z Cloning into '/opt/buildhome/clone/themes/gallery'...
2024-07-21T14:47:23.813611Z Submodule path 'themes/gallery': checked out 'b257ebaea43e4e81810a85ea62b3bf2e4f6fa98f'
2024-07-21T14:47:23.813724Z 
2024-07-21T14:47:23.81391Z  Using v2 root directory strategy
2024-07-21T14:47:23.838332Z Success: Finished cloning repository files
2024-07-21T14:47:25.695075Z Checking for configuration in a wrangler.toml configuration file (BETA)
2024-07-21T14:47:25.696066Z 
2024-07-21T14:47:25.794218Z No wrangler.toml file found. Continuing.
2024-07-21T14:47:25.934042Z Detected the following tools from environment: 
2024-07-21T14:47:25.934789Z Executing user command: hugo
2024-07-21T14:47:26.867099Z hugo: collected modules in 649 ms
2024-07-21T14:47:26.86733Z  WARN  Module "gallery" is not compatible with this Hugo version; run "hugo mod graph" for more information.
2024-07-21T14:47:26.867938Z Start building sites … 
2024-07-21T14:47:26.868086Z hugo v0.118.2-da7983ac4b94d97d776d7c2405040de97e95c03d+extended linux/amd64 BuildDate=2023-08-31T11:23:51Z VendorInfo=gohugoio
2024-07-21T14:47:26.868183Z 
2024-07-21T14:47:26.975915Z 
2024-07-21T14:47:26.976496Z                    | EN  
2024-07-21T14:47:26.976722Z -------------------+-----
2024-07-21T14:47:26.976812Z   Pages            |  7  
2024-07-21T14:47:26.976949Z   Paginator pages  |  0  
2024-07-21T14:47:26.977089Z   Non-page files   |  0  
2024-07-21T14:47:26.977188Z   Static files     |  3  
2024-07-21T14:47:26.977286Z   Processed images |  0  
2024-07-21T14:47:26.977389Z   Aliases          |  0  
2024-07-21T14:47:26.977486Z   Sitemaps         |  1  
2024-07-21T14:47:26.977576Z   Cleaned          |  0  
2024-07-21T14:47:26.977649Z 
2024-07-21T14:47:26.97774Z  Total in 760 ms
2024-07-21T14:47:26.992187Z Finished
2024-07-21T14:47:26.992719Z Note: No functions dir at /functions found. Skipping.
2024-07-21T14:47:26.992834Z Validating asset output directory
2024-07-21T14:47:28.576861Z Deploying your site to Cloudflare's global network...
2024-07-21T14:47:31.081204Z Uploading... (0/14)
2024-07-21T14:47:31.64209Z  Uploading... (4/14)
2024-07-21T14:47:31.759893Z Uploading... (9/14)
2024-07-21T14:47:31.792581Z Uploading... (14/14)
2024-07-21T14:47:31.792784Z ✨ Success! Uploaded 14 files (1.59 sec)
2024-07-21T14:47:31.792923Z 
2024-07-21T14:47:32.199805Z ✨ Upload complete!
2024-07-21T14:47:34.022303Z Success: Assets published!
2024-07-21T14:47:35.302774Z Success: Your site was deployed!

I went ahead and continued building locally. I created a few index.md files in a folder structure with images and pushed that change. From CloudFlare, I got:

2024-07-21T15:00:11.441411Z Cloning repository...
2024-07-21T15:00:12.20326Z  From https://github.com/thackmaster/site
2024-07-21T15:00:12.203692Z  * branch            6a543a65798226d11331ac81ebb326a84cde6cc2 -> FETCH_HEAD
2024-07-21T15:00:12.203811Z 
2024-07-21T15:00:12.262692Z HEAD is now at 6a543a6 test deployment with test assets
2024-07-21T15:00:12.26308Z  
2024-07-21T15:00:12.848252Z Submodule 'themes/gallery' (https://github.com/nicokaiser/hugo-theme-gallery.git) registered for path 'themes/gallery'
2024-07-21T15:00:12.8489Z   Cloning into '/opt/buildhome/clone/themes/gallery'...
2024-07-21T15:00:12.849052Z Submodule path 'themes/gallery': checked out 'b257ebaea43e4e81810a85ea62b3bf2e4f6fa98f'
2024-07-21T15:00:12.849157Z 
2024-07-21T15:00:12.849339Z Using v2 root directory strategy
2024-07-21T15:00:12.87703Z  Success: Finished cloning repository files
2024-07-21T15:00:14.695337Z Checking for configuration in a wrangler.toml configuration file (BETA)
2024-07-21T15:00:14.696088Z 
2024-07-21T15:00:14.782873Z No wrangler.toml file found. Continuing.
2024-07-21T15:00:14.924845Z Detected the following tools from environment: 
2024-07-21T15:00:14.925562Z Executing user command: hugo
2024-07-21T15:00:15.904211Z hugo: collected modules in 529 ms
2024-07-21T15:00:15.904431Z WARN  Module "gallery" is not compatible with this Hugo version; run "hugo mod graph" for more information.
2024-07-21T15:00:15.905282Z Start building sites … 
2024-07-21T15:00:15.905428Z hugo v0.118.2-da7983ac4b94d97d776d7c2405040de97e95c03d+extended linux/amd64 BuildDate=2023-08-31T11:23:51Z VendorInfo=gohugoio
2024-07-21T15:00:15.9055Z   
2024-07-21T15:00:15.984928Z ERROR render of "page" failed: "/opt/buildhome/repo/themes/gallery/layouts/_default/single.html:3:5": execute of template failed: template: _default/single.html:3:5: executing "main" at <partial "gallery.html" .>: error calling partial: "/opt/buildhome/repo/themes/gallery/layouts/partials/gallery.html:25:44": execute of template failed: template: partials/gallery.html:25:44: executing "partials/gallery.html" at <images>: can't evaluate field AutoOrient in type interface {}
2024-07-21T15:00:16.004208Z ERROR render of "section" failed: "/opt/buildhome/repo/themes/gallery/layouts/_default/list.html:5:9": execute of template failed: template: _default/list.html:5:9: executing "main" at <partial "album-card.html" .>: error calling partial: "/opt/buildhome/repo/themes/gallery/layouts/partials/album-card.html:1:15": execute of template failed: template: partials/album-card.html:1:15: executing "partials/album-card.html" at <partial "get-gallery.html" .>: error calling partial: "/opt/buildhome/repo/themes/gallery/layouts/partials/get-gallery.html:5:43": execute of template failed: template: partials/get-gallery.html:5:43: executing "partials/get-gallery.html" at <images>: can't evaluate field AutoOrient in type interface {}
2024-07-21T15:00:16.004447Z Total in 632 ms
2024-07-21T15:00:16.004578Z Error: error building site: render: failed to render pages: render of "home" failed: "/opt/buildhome/repo/themes/gallery/layouts/_default/home.html:3:5": execute of template failed: template: _default/home.html:3:5: executing "main" at <partial "featured.html" .>: error calling partial: "/opt/buildhome/repo/themes/gallery/layouts/partials/featured.html:2:17": execute of template failed: template: partials/featured.html:2:17: executing "partials/featured.html" at <partial "get-gallery.html" .>: error calling partial: "/opt/buildhome/repo/themes/gallery/layouts/partials/get-gallery.html:5:43": execute of template failed: template: partials/get-gallery.html:5:43: executing "partials/get-gallery.html" at <images>: can't evaluate field AutoOrient in type interface {}
2024-07-21T15:00:16.010548Z Failed: Error while executing user command. Exited with error code: 1
2024-07-21T15:00:16.019938Z Failed: build command exited with code: 1
2024-07-21T15:00:16.846933Z Failed: error occurred while running build command

My CloudFlare deployment is the default configuration, simply calling for the build command hugo. Locally, I'm building in a Node.js Docker container with Hugo and Go added in, with the hugo mod graph command outputting:

github.com/nicokaiser/hugo-gallery-starter github.com/nicokaiser/hugo-theme-gallery/v4@v4.1.12 => /workspaces/personal-site
github.com/nicokaiser/hugo-theme-gallery/v4@v4.1.12 gallery

Am I overlooking something? I've built in Jekyll and Astro before, first time trying out Hugo aside from the quickstart guide, but I'm not quite sure where to look next.

nicokaiser commented 1 month ago

I think these lines are the interesting ones:

2024-07-21T14:47:26.86733Z  WARN  Module "gallery" is not compatible with this Hugo version; run "hugo mod graph" for more information.
2024-07-21T14:47:26.867938Z Start building sites … 
2024-07-21T14:47:26.868086Z hugo v0.118.2-da7983ac4b94d97d776d7c2405040de97e95c03d+extended linux/amd64 BuildDate=2023-08-31T11:23:51Z VendorInfo=gohugoio

You are using Hugo v0.118.2, while this theme requires at least Hugo 0.121.2. Could you try to update Hugo or configure your Cloudflare deployment to use a newer version?

thackmaster commented 1 month ago

Thank you! I completely skipped over that version number. Setting my CloudFlare HUGO_VERSION to 0.129.0 fixed it. Not sure why it wasn't using the latest version by default