Skip to content
This repository has been archived by the owner on Jul 26, 2020. It is now read-only.
This repository has been archived by the owner on Jul 26, 2020. It is now read-only.

422 Unprocessable Entity on push #5

Open
Dermah opened this issue May 26, 2020 · 1 comment · May be fixed by #6
Open

422 Unprocessable Entity on push #5

Dermah opened this issue May 26, 2020 · 1 comment · May be fixed by #6

Comments

@Dermah
Copy link

Dermah commented May 26, 2020

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:

app.post('/:user/:repo/objects/batch', wrap(function* (req, res, next) {
// validate request body according to JSON Schema
try {
var body = yield parse.json(req);
req.jsonBody = body;
var valid = validate(body, BATCH_REQUEST_SCHEMA).valid;
if (!valid) {
let err = new Error();
err.status = 422;
next(err);
} else {

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:

"additionalProperties": false

@Dermah
Copy link
Author

Dermah commented May 26, 2020

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant