422 error deploying functions

I’m running into a functions deployment error when deploying via netlify-cli:

    args: deploy --dir=$dist_dir/site --functions=$dist_dir/functions --prod

Gives the following output:

- Hashing files...
- Looking for a functions cache...
✔ No cached functions were found
✔ Finished hashing 118 files and 4 functions
- CDN diffing files...
✔ CDN requesting 2 files and 4 functions
- Uploading 6 files
 ›   JSONHTTPError: Unprocessable Entity
Deploy path:    /github/workspace/dist/site
Functions path: /github/workspace/dist/functions
Deploying to main site URL...
 ›   Warning: JSONHTTPError:  422
 ›   Warning: 
  "name": "JSONHTTPError",
  "status": 422,
  "json": {
    "errors": "Uploaded file must be a non-empty zip"

Why is there the error?

Hi @mjgs :wave:t6: ,

Did you check your function log and see if it was throwing any errors?

Also can you please share your slug so we can look into this further?

As far as I can tell the deploy doesn’t reach Netlify, so no logs or errors there.

can you share your slug or site name so I can investigate? Did this work locally before taking this to Netlify?

I figured out what the issue was.

I setup the functions folder ages ago but only started trying to deploy the functions the past few days. In the folder there were a few placeholder function files I had added. These had no code in them, totally empty files!

That’s clearly the issue, thanks for your patience.

1 Like