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

422 Unprocessable Entity on push #5

@Dermah

Description

@Dermah

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions