Hello. I am getting a build error for the frontend when deploying my website in AWS Amplify. The issue only comes up when using a GetRemote
function. The issue does NOT come up, when testing my website in Cloud9 via $ hugo deploy --port 8080
or $ hugo
. Only in Amplify, the issue comes up. In Amplify, I have granted my execution role Admin rights for a test. This did not resolve the issue. I am using Live package updates for hugo.
This is the function I am calling in one of my posts:
{{ $data := "" }}
{{ $url := "https://pegel-konstanz-for-website.s3.eu-central-1.amazonaws.com/json/demo.json" }}
{{ with resources.GetRemote $url }}
{{ with .Err }}
{{ errorf "%s" . }}
{{ else }}
{{ $data = . | transform.Unmarshal }}
{{ end }}
{{ else }}
{{ errorf "Unable to get remote resource %q" $url }}
{{ end }}
{{ with $data }}
The current level of Lake Constance (Bodensee) is at {{ .current_level }} cm ( {{.change_vs_yesterday }} cm compared to the previous day).
{{ end }}
This is the error I get for the Frontend during the Build phase:
2024-01-22T07:56:42.686Z [INFO]: Start building sites …
hugo v0.121.2-6d5b44305eaa9d0a157946492a6f319da38de154 linux/amd64 BuildDate=2024-01-05T12:21:15Z VendorInfo=gohugoio
2024-01-22T07:56:42.781Z [INFO]: ERROR failed to fetch remote resource: Forbidden
2024-01-22T07:56:42.881Z [INFO]: Total in 245 ms
Error: error building site: logged 1 error(s)
2024-01-22T07:56:42.884Z [ERROR]: !!! Build failed
2024-01-22T07:56:42.884Z [ERROR]: !!! Non-Zero Exit Code detected
Any input appreciated. I am very irritated right now.