amplify-hosting
amplify-hosting copied to clipboard
Amplify Hosting failing Hugo builds
Before opening, please confirm:
- [X] I have checked to see if my question is addressed in the FAQ.
- [X] I have searched for duplicate or closed issues.
- [X] I have read the guide for submitting bug reports.
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
App Id
d3q5nd3xz6zwmz
Region
us-east-1
Amplify Hosting feature
Backend builds, Build settings, Not applicable
Describe the bug
Trying to deploy my Hugo static site. Amplify worked fine before and now failing during frontend build process with very little information around what has occurred. Site builds fine locally.
2022-07-01T22:51:34.637Z [INFO]: DEBUG 2022/07/01 22:51:34 Render XML for "sitemap" to "/sitemap.xml"
2022-07-01T22:51:34.673Z [INFO]: DEBUG 2022/07/01 22:51:34 Render 404 page to "/404.html"
2022-07-01T22:51:34.691Z [INFO]: DEBUG 2022/07/01 22:51:34 Render page to "/index.json"
2022-07-01T22:51:50.115Z [WARNING]: /codebuild/output/src930700667/src/mysite.net/amplify.sh: line 36: 2372 Killed hugo --gc --cleanDestinationDir --debug
2022-07-01T22:51:50.172Z [ERROR]: !!! Build failed
2022-07-01T22:51:50.177Z [ERROR]: !!! Non-Zero Exit Code detected
2022-07-01T22:51:50.177Z [INFO]: # Starting environment caching...
2022-07-01T22:51:50.189Z [INFO]: # Uploading environment cache artifact...
2022-07-01T22:51:50.328Z [INFO]: # Environment caching completed
Terminating logging...
Expected behavior
Site passes build step and deploys
Reproduction steps
- Commit update to GitHub
- Wait for amplify pipeline to fail
Build Settings
version: 1
frontend:
phases:
preBuild:
commands:
- curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep "browser_download_url.*hugo_extended.*_Linux-64bit\.tar\.gz" | cut -d ":" -f 2,3 | tr -d '\\"' | wget -qi -
- tar -xzf "$(find . -name "*Linux-64bit.tar.gz")"
- chmod +x hugo
- mv hugo /usr/bin/hugo
- rm -rf "$(find . -name '*Linux-64bit.tar.gz')"
- hugo version
build:
commands:
- hugo version
- hugo --debug
artifacts:
baseDirectory: public
files:
- '**/*'
cache:
paths: []
Additional information
Hugo+Extended version is what i use.
The issue is so random as well. Same codebase, just worked for some odd reason in dev but when dev merged into prd, same failure again.
Both development and main branches are identical.
I bet on my next push to development that it will fail again.
Fails at same spot always:
Looking at when it doesn't fail, seems to be something with index.xml? But no idea if that's it or something else.
Some additional logging info, not sure if it helps, my development is failing on builds again as well so that pass must have been a fluke:
2022-07-05T22:59:16.445Z [INFO]: DEBUG 2022/07/05 22:59:16 Render page to "/index.json"
2022-07-05T22:59:19.204Z [INFO]: Alloc = 4.7 GB
TotalAlloc = 59.9 GB
Sys = 6.3 GB
NumGC = 81
2022-07-05T22:59:24.324Z [INFO]: Alloc = 5.4 GB
TotalAlloc = 60.6 GB
Sys = 6.7 GB
NumGC = 81
2022-07-05T22:59:31.882Z [INFO]: Alloc = 5.5 GB
TotalAlloc = 60.7 GB
Sys = 6.8 GB
NumGC = 81
2022-07-05T22:59:31.962Z [WARNING]: /codebuild/output/src688803540/src/geeklingo.net/amplify.sh: line 36: 2457 Killed hugo --verbose --debug -D --printI18nWarnings --printMemoryUsage --printPathWarnings --printUnusedTemplates
2022-07-05T22:59:31.966Z [ERROR]: !!! Build failed
2022-07-05T22:59:31.967Z [ERROR]: !!! Non-Zero Exit Code detected
Hi, I have the same issues. I can have a site build in AWS amplify time after time. Then it suddenly fails and keeps failing to build.
It's pretty painful.
This usually bites me in the arse after some minor update I decided to do just before bed time or going out.
It's like some kind of evil bug.
I have the similar issue. When building the frontend, an error is reported that parse failed in a template file. This issue was resolved by specifying that Amplify build to use the latest version of Hugo.
First make sure the template file has no syntax errors.
Then specify the Hugo version: AWS Amplify Console -> Your App -> App Settings -> Build settings -> Build image settings - "Edit" button -> Live package updates -> Hugo -> Version,
fill in the latest Hugo version number, for example: 0.105.0
. Be careful not to add the letter v
in front of the version number.
Hugo released versions can be viewed here https://github.com/gohugoio/hugo/releases/
Hi everyone 👋 , thanks for your continued patience and apologies for the delayed response on the thread.
Currently, the Amplify Hosting compute container uses Hugo version 0.75.1
by default to build your Hugo sites. If you are running into errors during the frontend build step, our recommendation would be to use the live package update feature for the Hugo package to override the default version and you can either specify a specific version or ensure that the latest version is always installed during the build.
Hope this information helps unblock your builds!
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.
This issue has been automatically locked.