statamic / ssg

The official Statamic Static Site Generator
229 stars 23 forks source link

Throw when SSG fail unexpectedly #70

Closed MadeByMike closed 2 years ago

MadeByMike commented 2 years ago

Bug Description

Currently errors are swallowed in the SSG build step. This mean CI can't catch the error, which means broken sites are published.

To give a specific example I have a site where the PHP/Glide version on Netlify servers fails to transform a webp images with: Unable to decode image from file (/tmp/Glide4qCOqe) This meant the topic page /blog/topics/news failed to be generated. Failing to build pages is not unexpected but in this case glide was throwing correctly and the SSG was catching and ignoring this perhaps because it was not distinguished from a non-existent route?.

It should be possible to distinguish these errors and throw\halt the build. There is no situation where anyone wants a site with errors to be published so I think it's critical that CI can catch this and halt publishing. I'm super nervous as I have a site in production where this could happen any day.

How to Reproduce

You can force a route to throw and run SSG.

jasonvarga commented 2 years ago

This belongs on the ssg repo.

tao commented 2 years ago

I've had this come up again recently and it's a feature that would really help in production:

[✘] /history/team (The ListObjects operation requires non-empty parameter: Bucket)
[✘] /articles/egypt (The ListObjects operation requires non-empty parameter: Bucket)
[✘] /articles/egypt/gallery (The ListObjects operation requires non-empty parameter: Bucket)
[✘] /history/notebook (The ListObjects operation requires non-empty parameter: Bucket)

In this case, I forgot to include one of the S3 bucket urls so these pages were not generated and uploaded, which resulted in some 404s.