Failed to Deploy on Netlify Due to End of Support for Build Image
Thank you for your continued support.
This article contains advertisements that help fund our operations.
⇨ Click here for the React article index
I documented the issue I encountered when trying to deploy my blog created with Gatsby on Netlify after a long time, only to find that the build failed due to the end of support for the build image.
Error Due to End of Support for Build Image
Error Message
11:58:53 PM: ---------------------------------------------------------------------
UNSUPPORTED BUILD IMAGE
The build image for this site uses Ubuntu 16.04 Xenial Xerus, which is no longer supported.
To enable builds for this site, select a later build image at the following link:
https://app.netlify.com/sites/epic-yalow-39a3ea/settings/deploys#build-image-selection
For more details, visit the build migration guide:
https://answers.netlify.com/t/please-read-end-of-support-for-xenial-build-image-everything-you-need-to-know/68239
---
It appears that the build failed due to the end of support for the build image.
How to Change the Build Image
This can be resolved by updating the settings in the Netlify management console.
- Go to Account Home ⇨ Select the site ⇨ Site Settings
- From the side menu, select "Build & Deploy"
- Edit the Build image selection settings
- Change to Ubuntu Focal 20.04 (default)
Error Due to Cache
Error Message
11:05:05 AM: build-image version: d7b3813f01c06610bc1723ff1b22446513ee7941 (focal)
11:05:05 AM: build-image tag: v4.14.3
11:05:05 AM: buildbot version: 4bbbb4f3037b3dc1dcca89f1a4b61b3a106a845b
11:05:21 AM: Fetching cached dependencies
11:05:21 AM: Failed to fetch cache, continuing with build
11:05:21 AM: Starting to prepare the repo for build
11:05:21 AM: No cached dependencies found. Cloning fresh repo
11:05:21 AM: git clone https://github.com/username/blog
11:07:30 AM: Error cloning repository: https://github.com/username/blog
11:07:30 AM: Creating deploy upload records
11:07:30 AM: Failing build: Failed to prepare repo
11:07:41 AM: Failed during stage 'preparing repo': exit status 128
11:07:41 AM: Finished processing build request in 2m35.220824723s
The build failed because the repository could not be cloned, which prevented preparation for the build.
Solution: Reset the Cache
This solution was not obvious from the error message. However, trying to reset the deploy cache resolved the issue.
In the management console:
- Open the failed Deploy page
- Click Retry
- Select Clear cache and retry with latest branch commit
Conclusion
Resetting the cache after changing the build image might not be commonly mentioned in other articles, so this could be an unusual case.
I hope this helps someone.