# Frontent build error in Amplify when calling external data

**URL:** <https://discourse.gohugo.io/t/frontent-build-error-in-amplify-when-calling-external-data/47905>\
**Category:** support\
**Tags:** off-topic\
**Created:** [January 22, 2024, 8:57am UTC](https://discourse.gohugo.io/t/frontent-build-error-in-amplify-when-calling-external-data/47905 "2024-01-22T08:57:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidb](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidb/32/16297_2.png) [@davidb](https://discourse.gohugo.io/u/davidb)\
**Post date:** [January 22, 2024, 8:57am UTC](https://discourse.gohugo.io/t/frontent-build-error-in-amplify-when-calling-external-data/47905/1 "2024-01-22T08:57:44Z")

</div>

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:

```auto
{{ $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:

```auto

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.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [January 22, 2024, 10:06am UTC](https://discourse.gohugo.io/t/frontent-build-error-in-amplify-when-calling-external-data/47905/2 "2024-01-22T10:06:19Z")

</div>

This isn’t a Hugo problem. Check your bucket permissions, and test by opening the URL in a browser.

---

<div class="post-metadata">

**Author:** ![davidb](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidb/32/16297_2.png) [@davidb](https://discourse.gohugo.io/u/davidb)\
**Post date:** [January 22, 2024, 12:26pm UTC](https://discourse.gohugo.io/t/frontent-build-error-in-amplify-when-calling-external-data/47905/3 "2024-01-22T12:26:59Z")

</div>

Thank you for your response. Agreed. This is not a Hugo problem. This is an AWS setup issue related to Hugo.  
I transitioned the discussion to the Amplify Discord channel:

> **[Discord - A New Way to Chat with Friends & Communities](https://discord.com/channels/705853757799399426/1198959139846631444)**
>
> Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.

Happy to close and or delete this Topic here.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [January 22, 2024, 1:10pm UTC](https://discourse.gohugo.io/t/frontent-build-error-in-amplify-when-calling-external-data/47905/4 "2024-01-22T13:10:47Z")

</div>

> [@davidb](#):
>
> This is an AWS setup issue related to Hugo.

This is what I see when visiting the URL in a browser:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/b/6/b61161b80ef53a2eb0d806aa5ae16a76575f8924.png)

---

<div class="post-metadata">

**Author:** ![davidb](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidb/32/16297_2.png) [@davidb](https://discourse.gohugo.io/u/davidb)\
**Post date:** [January 22, 2024, 1:36pm UTC](https://discourse.gohugo.io/t/frontent-build-error-in-amplify-when-calling-external-data/47905/5 "2024-01-22T13:36:46Z")

</div>

Thank you! Spot on. My mistake.  
The bucket is public. The policy was right. But I had provided the wrong URL in my function.

I am very sorry for bugging you with an unnecessary question here.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [January 24, 2024, 1:37pm UTC](https://discourse.gohugo.io/t/frontent-build-error-in-amplify-when-calling-external-data/47905/6 "2024-01-24T13:37:24Z")

</div>

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