One time build error on Cloudflare Pages

Using Cloudflare Pages, one of the builds failed with this error

Error: Error building site: failed to render pages: render of "page" failed: "/opt/buildhome/repo/themes/test/layouts/_default/baseof.html:45:8": execute of template failed: template: _default/single.html:45:8: executing "_default/single.html" at <partial "assets/foot.html" .>: error calling partial: "/opt/buildhome/repo/themes/test/layouts/partials/assets/foot.html:7:102": execute of template failed: template: partials/assets/foot.html:7:102: executing "partials/assets/foot.html" at <resources.Copy>: error calling Copy: interface conversion: *resources.errorResource is not resources.resourceCopier: missing method cloneTo

The code in question is as below, which runs in production only and is combined with other JS code from the repo.

{{- $index := resources.GetRemote "https://unpkg.com/@minimal-analytics/ga4/dist/index.js" | resources.Copy "js/index.js" }}

Hugo v0.100.1 with Go 1.18.3 set as environment variables.

Yea, I forgot to handle that. Basically you have a GetRemote that has failed, which the Copy should have detected.

If will fix this, but you can work around this by:

{{- $index := resources.GetRemote "https://unpkg.com/@minimal-analytics/ga4/dist/index.js" }}
{{ if not $index.Err }}
{{ $index  = $index | resources.Copy ... }}
{{ end }}

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.