I’m paying for the functions addon - this broke my site in production for 24 hours (fixed by publishing a past deploy) and currently means it’s impossible for me to deploy my Netlify functions.
Here’s two test preview URLs:
Those two deploys are two independent changes, with minimal differences from the last working deploy - the first contains only a bump of the semver package from 5.7.1 to 5.7.2, while the second deploy contains only an additional trivial /api/ping endpoint that does nearly nothing, just to test this issue, which still fails with a 500 (code here - this should definitely work imo).
In both cases, these APIs work perfectly locally, and everything was working correctly in previous deploys for many years. I’ve deployed this on preview URLs because previously this was deployed automatically to production and resulted in a complete outage for my application. Nothing appears in the function logs from these broken deploys whatsoever, and my application doesn’t seem to run at all as far as I can tell (I have Sentry in place for error reporting, and no errors are reported).
This code is built in GitHub Actions and deployed via the API. That’s been set up & unchanged for 2 years now though, and this has started failing just recently. An example GHA build deploying this code is here: WIP: Add a test ping endpoint to debug Netlify issues · httptoolkit/accounts@a63a75e · GitHub
Your workflow of building functions is not supported: WIP: Add a test ping endpoint to debug Netlify issues · httptoolkit/accounts@a63a75e (github.com)
You should be using Netlify CLI for building functions and even to be deploying. We can’t provide support with 3rd party build tools and scripts.
To answer your question though, we’re getting an InvalidZipFileException: Lambda was not able to unzip the file
error from AWS Lambda. Thus, the error. Since the files are not built in the way we would expect them to be, I can’t further say or investigate what part of this is exactly causing issues.
@hrishikesh deploying directly via zip file is listed in your own docs though: Get started with the Netlify API | Netlify Docs. Is that not officially supported? Everything is built & deployed from the CI flow, so using an action to automated this seemed like the best option.
Is there an equivalent Netlify GitHub Action for “deploy this content directly” somewhere I should use instead? Or is GitHub Actions not supported at all? Everything else in the organization is built via GHA so that’s very strongly preferable. I’ve looked through GitHub Marketplace · Actions to improve your workflow · GitHub but they’re all implemented by 3rd parties.
Thanks for the error details though, that’s definitely helpful. I’ll look into the unzip issue and see what I can find out there anyway. As feedback, I really think it would be better if your zip-upload API endpoint didn’t deploy if it can’t read the zip! And it would be useful to have been able to read that error you shared for myself.
I don’t remember zip file uploads supporting Netlify Functions. They either need the file digest method or deploying via Neltify CLI. But that’s not what I’m talking about anyways.
I’m talking about using Webpack to build functions yourself.
Simply installing Netlify CLI inside your GitHub Actions script and build and deploy using that. It would be easier to use that instead of a custom configuration anyways.
We can read the zip. AWS cannot. And that cannot be checked before invoking the function. The zip might be valid, just not in the format AWS expects.
To be clear, deploying site via Zip and the function bundle zip are two different things. Your error is related to the latter.