Site icon Denis Bouquet

Astro build via Jenkins timing out? Check your images first

A quick one from a recent Astro project that deploys with Jenkins. Our deployment suddenly started taking much longer than expected and eventually timing out during the build. (set to 120 seconds timeout)

Before looking at the server, CI configuration or increasing the deployment timeout, you should check what Astro is actually doing with your images.

With Astro’s image optimisation, a single source image can generate multiple output files depending on the sizes and formats requested. That can become super big quickly when you have lots of images. Hub page with 30 images can easily turn to a few hundreds of images with different media-query sizes and formats. Then we also had a serie of articles being rebuilt each time, the more article the more assets…

Check how many images you are generating

A simple place to start is your build output.

Run:

npm run build

and keep an eye on the image generation during the build.

If you’re generating hundreds or thousands of image variants, check the components where you’re using <Image /> or <Picture />, particularly anything rendered inside a loop.

Also check the dimensions of your source images.

You can increase the timeout but check first

It’s tempting to fix a failed CI deployment by simply giving the build more time.

But first check:

In our case, investigating the image generation was a much better angle than simply increasing the deployment timeout.

Exit mobile version