question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

lerna run produces "stdout maxBuffer exceeded"

See original GitHub issue

when running lerna run in parallel and stream i eventually get “stdout maxBuffer exceeded” lerna run ${command} --stream --parallel --max-buffer=999999999 when debugging it looks like the maxBuffer injected to lerna options, but not to get-stream module

“lerna”: “3.22.1”

Expected Behavior

max-buffer should be used when using --stream

Current Behavior

lerna sill argv {
lerna sill argv   _: [ 'run' ],
lerna sill argv   stream: true,
lerna sill argv   parallel: true,
lerna sill argv   'max-buffer': 999999999,
lerna sill argv   maxBuffer: 999999999,
lerna sill argv   loglevel: 'verbose',
lerna sill argv   scope: [ '@logz-prj/app-api', '@logz-prj/app-frontend' ],
lerna sill argv   lernaVersion: '3.22.1',
lerna sill argv   '$0': '/Users/***/***/gaia-hermes-ws/node_modules/.bin/lerna',
lerna sill argv   script: 'watch'
lerna sill argv }
lerna notice cli v3.22.1
lerna verb rootPath /Users/***/****/gaia-hermes-ws
lerna info versioning independent
lerna notice filter including ["@logz-prj/app-api","@logz-prj/app-frontend"]
lerna info filter [ '@logz-prj/app-api', '@logz-prj/app-frontend' ]
lerna info Executing command in 2 packages: "yarn run watch"
lerna sill npmRunScript.stream [ 'watch', [], '@logz-prj/app-api' ]
lerna sill getExecOpts /Users/****/****/gaia-hermes-ws/app-api undefined

when tracing the getStream function, the max buffer is the default 10M and not my specific 999999999

getStream { maxBuffer: 10000000 }
Trace
    at getStream (/Users/***/***/gaia-hermes-ws/node_modules/get-stream/index.js:21:10)
    at getStream (/Users/***/***/gaia-hermes-ws/node_modules/execa/index.js:135:9)
    at handlePromise (/Users/***/***/gaia-hermes-ws/node_modules/execa/index.js:270:3)
    at ChildProcess.spawned.catch (/Users/***/***/gaia-hermes-ws/node_modules/execa/index.js:313:32)
    at wrapError (/Users/***/***/gaia-hermes-ws/node_modules/@lerna/child-process/index.js:114:25)
    at Object.spawnStreaming (/Users/***/***/gaia-hermes-ws/node_modules/@lerna/child-process/index.js:66:10)
    at Function.stream (/Users/***/***/gaia-hermes-ws/node_modules/@lerna/npm-run-script/npm-run-script.js:27:32)
    at RunCommand.runScriptInPackageStreaming (/Users/***/***/gaia-hermes-ws/node_modules/@lerna/run/index.js:175:25)
    at /Users/***/***/gaia-hermes-ws/node_modules/@lerna/run/index.js:167:54
    at /Users/***/***/gaia-hermes-ws/node_modules/p-map/index.js:47:21

Possible Solution

inject the maxBuffer value to get-stream module on run --stream

Steps to Reproduce (for bugs)

  1. lerna run watch --stream --parallel --max-buffer=999999999
  2. have a big chunk of stdout
  3. you’ll eventually get “stdout maxBuffer exceeded”
lerna.json

{
  "npmClient": "yarn",
  "useWorkspaces": true,
  "version": "independent"
}

lerna-debug.log

0 silly argv { _: [ 'run' ],
0 silly argv   stream: true,
0 silly argv   parallel: true,
0 silly argv   'max-buffer': 100000000,
0 silly argv   maxBuffer: 100000000,
0 silly argv   scope: '@logz-tools/kibana-server',
0 silly argv   lernaVersion: '3.22.1',
0 silly argv   '$0':
0 silly argv    '/Users/****/****/gaia-hermes-ws/node_modules/.bin/lerna',
0 silly argv   script: 'watch' }
1 notice cli v3.22.1
2 verbose rootPath /Users/****/****/gaia-hermes-ws
3 info versioning independent
4 notice filter including "@logz-tools/kibana-server"
5 info filter [ '@logz-tools/kibana-server' ]
6 info Executing command in 1 package: "yarn run watch"
7 silly npmRunScript.stream [ 'watch', [], '@logz-tools/kibana-server' ]
8 silly getExecOpts /Users/****/****/gaia-hermes-ws/tools/kibana-server undefined
9 error MaxBufferError: stdout maxBuffer exceeded
9 error     at PassThrough.stream.on (/Users/****/****/gaia-hermes-ws/node_modules/get-stream/index.js:41:19)
9 error     at PassThrough.emit (events.js:194:15)
9 error     at addChunk (_stream_readable.js:284:12)
9 error     at readableAddChunk (_stream_readable.js:261:13)
9 error     at PassThrough.Readable.push (_stream_readable.js:220:10)
9 error     at PassThrough.Transform.push (_stream_transform.js:151:32)
9 error     at PassThrough.afterTransform (_stream_transform.js:92:10)
9 error     at PassThrough._transform (_stream_passthrough.js:42:3)
9 error     at PassThrough.Transform._read (_stream_transform.js:190:10)

Context

we suffer from this bug for some time, trying to get an alternative. basically slows us down when we develop

Your Environment

Executable Version
lerna --version 3.22.1
npm --version 6.14.5
yarn --version 1.22.0
node --version v12.14.1
OS Version
macOS Catalina 10.15.6

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:17
  • Comments:6

github_iconTop GitHub Comments

15reactions
njacob1001commented, Dec 17, 2020

Same issue here

3reactions
Arrodlcommented, Apr 13, 2021

Any update on this? having the same error

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stdout buffer issue using node child_process - Stack Overflow
maxBuffer specifies the largest amount of data allowed on stdout or stderr - if this value is exceeded then the child process is...
Read more >
Unable to package due to exceeding maxBuffer length
I have a ClojureScript app that runs on NodeJS. After creating a few Lambdas I have hit a point of not being able...
Read more >
Troubleshooting | Lerna
Run lerna import with the --max-buffer flag and provide a large enough number (in bytes). At the writing of this entry the underlying...
Read more >
lerna: Versions - Openbase
Initialize the git repo if it isn't already. lerna exec, lerna run and scoping (#152) @joscha; Emit partial stderr output from child on...
Read more >
A guide through The Wild Wild West of setting up a mono repo ...
Lerna calls yarn/npm install for each package inside the project and then creates symlinks between the packages that refer to each other. Being...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found