node-git-lfs icon indicating copy to clipboard operation
node-git-lfs copied to clipboard

422 Unprocessable Entity on push

Open Dermah opened this issue 5 years ago • 1 comments

I'm getting a 422 Unprocessable Entity error from node-git-lfs when trying to push to the server using git-lfs/2.11.0.

I dug in to it and it looks like the error is thrown when validating the batch request here: https://github.com/kzwang/node-git-lfs/blob/ebbe7d88a796428f313cf6efdb1dffbf7f791fd3/lib/routes/batch.js#L100-L110

My git-lfs client sends through a body that looks like this

{ operation: 'upload',
  objects:
   [ { oid:
        '19f2dcd3b4f260b2d6e5cdec56c58d2b150526b262cb0ca15b8d86eb6398d3dd',
       size: 386583 } ],
  transfers: [ 'lfs-standalone-file', 'basic' ],
  ref: { name: 'refs/heads/master' } }

I think the transfers and ref keys are failed by the JSON schema validation. Removing this line from the schema makes everything work smoothly: https://github.com/kzwang/node-git-lfs/blob/ebbe7d88a796428f313cf6efdb1dffbf7f791fd3/schema/http-v1-batch-request-schema.json#L27

Dermah avatar May 26 '20 13:05 Dermah

Ah yeah the actual schema published in git-lfs is slightly different to the one that exists in this repo

Dermah avatar May 26 '20 13:05 Dermah