"No records matched" response with file digest method of deploying functions (bad documentation?)

The documentation for deploying functions using a “file digest method” is extremely poor. I’ve followed the steps in the documentation exactly with no success. There’s clearly some weird undocumented behaviour going on, so I’m coming to you to ask for some support.

  1. Get checksum
sha256sum api.js | cut -d " " -f 1
  1. Write to JSON
{
  "functions": { "api": "<>" }
}
  1. Create a new site
curl -X POST -H "Authorization: Bearer <>" "https://api.netlify.com/api/v1/sites"
  1. Create a new deploy
curl -X POST --json "@digest.json" -H "Authorization: Bearer <>" "https://api.netlify.com/api/v1/sites/<site_id>/deploys" | jq
  1. Zip the function
zip api.zip api.js
  1. PUT to functions endpoint
curl -X PUT -H "Content-Type: application/octet-stream" --data-binary "@api.zip" -H "Authorization: Bearer <>" "https://api.netlify.com/api/v1/deploys/<deploy_id>/functions/api?runtime=js"

Result: {“code”:500,“message”:“No records matched”}

Any advice on how to fix this would really help.

Here’s an example:

f-120986.zip (72.9 KB)