danger-js: danger fails to run locally when diff is larger than maxBuffer size

When running danger locally, it runs the command git diff master...HEAD to generate a diff to work on. This command is executed using the default maxBuffer here.

Backtrace:

(demi) yarn danger local --verbose
yarn run v1.6.0
$ /home/demi/pewpewthespells-com/node_modules/.bin/danger local --verbose
Could not get diff from git between master and HEAD
{ Error: stdout maxBuffer exceeded
    at Socket.onChildStdout (child_process.js:305:14)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at addChunk (_stream_readable.js:250:12)
    at readableAddChunk (_stream_readable.js:233:13)
    at Socket.Readable.push (_stream_readable.js:195:10)
    at Pipe.onread (net.js:586:20) cmd: 'git diff master...HEAD' }
Done in 1.53s.

The problem originates from the default being 200kb, and large git diffs can easily exceed that (in my case the diff was 24mb). I was able to get past this issue by locally modifying my danger module code to include a much larger maxBuffer size, but beyond putting a ridiculously large constant in the code, i’m not sure what the best patch for this problem is.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 23 (14 by maintainers)

Most upvoted comments

There were binary files but they only appeared in the diff as marked as binary file adds, not the contents of said files. I feel like this is going to potentially be a problem that keeps on happening unless the maxBuffer variable can be scaled to fit? so maybe having it pipe out to a temporary file instead of stdout would be for the best.