I’ve just confirmed with another project that this error only appears when a deploy is triggered via the Netlify UI or by a push to the git repo. When running netlify deploy locally everything works as expected.
I really need to understand what is causing this as we are working on a large project that will be deployed on Netlify in November and I need to make sure we can avoid the same issue.
Okay, thanks to this thread, I found the answer, which I will repeat here for any other poor Eleventy Serverless users encountering this issue. It seems this was caused by a change at the Netlify side.