Netlify-cli deploy: failed to upload function: unable to decode manifest file

We have been deploying a website of ours using a GitHub CI deployment via netlify-cli. Yesterday, while testing a PR, the deployment failed with a JSONHTTPError: Bad Request. The relevant part of the netlify-cli invocation is:

npx netlify-cli deploy --dir=dist --functions=site/functions --skip-functions-cache

To debug this locally, I used manual deployments to a debug alias. Testing demonstrated that the same error could be reproduced on the repository’s master branch, so the PR change itself is not likely the problem.

Inspection of the invocation itself revealed that the underlying issue was the failure by netlify-cli to upload the site’s Netlify function (via uploadDeployFunction). The message produced by the endpoint is:

unable to decode manifest file: json: cannot unmarshal string into Go struct field functionManifest.version of type int

A deep dive into the Netlify OpenAPI code suggested that the relevant field is this one. The docs indicate this data is created by zip-it-and-ship-it as part of zipFunctions if a manifest option is passed. However, such a manifest is never created as part of a netlify-cli deploy (as the option is never passed, see here), and this aspect of the code has not been modified in years.

Inspection of the generated function zip file (package.zip for site/functions/package.ts) also shows no manifest or even something that could look like one. The only manifest-like object in the zip file is the package.json.

Therefore, it is unclear to me why the server is expecting such a manifest and why this is causing a breakage now. Furthermore, as we are deploying using the official netlify-cli deploy, which packs all this itself, I do not understand how the bundle could have become malformed.

Site Info

  • Repository: https://github.com/leanprover/reservoir
  • Site Address: reservoir-lean-lang.netlify.app or reservoir.lean-lang.org

hi, thanks for providing these details @tydeu I can see you wrote into our helpdesk as well. Our team will follow up with you there. Thank you for your patience! (;